Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming the default <code>JPanel</code> layout, <code>FlowLayout</code>, give the <a href="http://download.oracle.com/javase/6/docs/api/javax/swing/JTextField.html#JTextField%28int%29" rel="nofollow noreferrer"><code>JTextField</code></a> a non-zero number of <code>columns</code>, and give the <a href="http://download.oracle.com/javase/6/docs/api/javax/swing/JLabel.html" rel="nofollow noreferrer"><code>JLabel</code></a> a <code>JLabel.LEFT</code> constraint.</p> <p>Addendum: </p> <blockquote> <p>a full grown <code>JTextField</code></p> </blockquote> <p>Something like this?</p> <p><img src="https://i.stack.imgur.com/Igg0Z.png" alt="enter image description here"></p> <pre><code>import java.awt.*; import javax.swing.*; /** * @see http://stackoverflow.com/questions/5773874 */ public class JTabbedText { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { private final JTabbedPane jtp = new JTabbedPane(); @Override public void run() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jtp.setPreferredSize(new Dimension(400, 200)); jtp.addTab("Control", new MyPanel("Channel")); f.add(jtp, BorderLayout.CENTER); f.pack(); f.setVisible(true); } }); } private static class MyPanel extends JPanel { private final JLabel label = new JLabel("", JLabel.LEFT); private final JTextField text = new JTextField(); public MyPanel(String name) { this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); label.setText(name); label.setAlignmentY(JLabel.TOP_ALIGNMENT); text.setAlignmentY(JTextField.TOP_ALIGNMENT); this.add(label); this.add(text); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload