<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
  <channel>
    <title>Udvikleren.dk - Seneste [jlabel] forum tråde</title>
    <description>De seneste forum tråde i [jlabel] på Udvikleren.dk</description>
    <link>http://www.udvikleren.dk/</link>
    <pubDate>Wed, 29 Apr 2026 03:45:40 GMT</pubDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Udvikleren.dk RSS Feeder</generator>
    <ttl>60</ttl>
    <item>
      <title>Kan ikke bruge \n (newline) i mit JLabel, virker heller ikke med html tags</title>
      <description>Hej alle! Har lavet et prompt vindue, og det skal fungere ligesom CMD; ved hver kommando skal den skrive output på en ny linje, og når der ikke er mere plads i JLabel, skal den kører det hele en gang op så den har plads til en ny linje. Vil også gerne have en scrolle funktion, sådan så man kan se de ældre kommandoer og output man har skrevet/fået. &lt;br /&gt;&lt;br /&gt;&lt;div class="codeboxheader" id="code_19495907" onclick="ToggleCodeBox(this.id);"&gt;&lt;img id="code_19495907_arrow" src="/images/icons/codeboxarrow_down.gif" alt="Fold kodeboks ind/ud" title="Fold kodeboks ind/ud" /&gt;Java kode&amp;nbsp;&lt;/div&gt;&lt;pre id="code_19495907code" style="border-top: 0px; display: none;"&gt;&lt;ol&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #0000FF;"&gt;import&lt;/span&gt;&lt;span style="color: #000000;"&gt; java.awt.Color;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;import&lt;/span&gt;&lt;span style="color: #000000;"&gt; javax.swing.&lt;/span&gt;&lt;span style="color: #000000;"&gt;*&lt;/span&gt;&lt;span style="color: #000000;"&gt;;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; Window &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;extends&lt;/span&gt;&lt;span style="color: #000000;"&gt; JFrame&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;{&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    Keyboard keys;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    JPanel panel;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    JLabel output, input;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    String command &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    String outputString &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;gt;&amp;gt; Welcome to DotMS! \ntest&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;;&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; Window()&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    {&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.setVisible(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;true&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.setDefaultCloseOperation(EXIT_ON_CLOSE);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.setSize(&lt;/span&gt;&lt;span style="color: #000000;"&gt;600&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;400&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        keys &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; Keyboard(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.setFocusable(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;true&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.addKeyListener(keys);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        panel &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; JPanel();&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.add(panel);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        panel.setLayout(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;null&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        panel.setOpaque(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;true&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        panel.setBackground(Color.BLACK);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        output &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; JLabel();&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        output.setForeground(Color.WHITE);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        output.setBounds(&lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;600&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;300&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        output.setText(outputString);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        panel.add(output);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        input &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; JLabel();&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        input.setForeground(Color.WHITE);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        input.setBounds(&lt;/span&gt;&lt;span style="color: #000000;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;200&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;600&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;50&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        input.setText(&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;+&lt;/span&gt;&lt;span style="color: #000000;"&gt; command);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        panel.add(input);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    }&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; refreshOutput()&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    {&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        output.setText(&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;+&lt;/span&gt;&lt;span style="color: #000000;"&gt; outputString.toUpperCase());&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    }&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; refreshInput()&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    {&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        input.setText(&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;+&lt;/span&gt;&lt;span style="color: #000000;"&gt; command);&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    }&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;static&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; main(String args[])&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    {&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;        Window main &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; Window();&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;    }&lt;/span&gt;&lt;/li&gt;&lt;li style="padding: 0; margin: 0;"&gt; &lt;span style="color: #000000;"&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Får udelukkende outputtet "Welcome to DotMS! test"</description>
      <link>http://www.udvikleren.dk/forum/39301/kan-ikke-bruge-n-(newline)-i-mit-jlabel,-virker-heller-ikke-med-html-tags/</link>
      <pubDate>Fri, 14 Dec 2012 14:27:51 GMT</pubDate>
    </item>
    <item>
      <title>Java Swing</title>
      <description>Hej alle udviklere! &lt;img src="/images/smileys/smiley.gif" alt=":)" title=":)" /&gt;&lt;br /&gt;&lt;br /&gt;Jeg har et problem som jeg simpelthen ikke kan løse.&lt;br /&gt;&lt;br /&gt;Jeg er ved at lave et program med Java Swing.&lt;br /&gt;Jeg har lavet en hovedoverskrift med JLabel. Nu prøver jeg på at lave en under-overskrift, som, som navnet antyder, skal være under overskriften. Problemet er at jeg ikke kan finde en løsning til hvordan jeg putter underoverskrifts-label'en under den første. Jeg har prøvet setVerticalAlignment, setVerticalTextPosition og en milliard andre ting.&lt;br /&gt;&lt;br /&gt;Jeg bruger JFrame med layoutet FlowLayout.&lt;br /&gt;&lt;br /&gt;Er der nogen der har en løsning?</description>
      <link>http://www.udvikleren.dk/forum/34165/java-swing/</link>
      <pubDate>Wed, 20 Apr 2011 21:15:20 GMT</pubDate>
    </item>
  </channel>
</rss>