List of usage examples for javax.swing JLabel JLabel
public JLabel(Icon image)
JLabel
instance with the specified image. From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.GREEN); JFrame frame = new JFrame(); frame.add(label);/* w ww .jav a2 s. co m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JLabel label = new JLabel("Label with image in Tooltip!"); label.setToolTipText("<html><img src=\"" + Main.class.getResource("tooltip.gif") + "\"> Tooltip "); label.setHorizontalAlignment(JLabel.CENTER); frame.setContentPane(label);//from w w w . j ava 2s .c om frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(100, 100, 200, 100); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextField component = new JTextField(); JLabel label = new JLabel("Name:"); label.setDisplayedMnemonic('N'); label.setLabelFor(component);//from w w w. j av a2 s .co m }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("TitleLessJFrame"); frame.getContentPane().add(new JLabel(" HEY!!!")); frame.setUndecorated(true);//from ww w. j a v a2 s. c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color myColor = Color.RED; JLabel label = new JLabel("First Name"); label.setForeground(myColor.darker()); JFrame frame = new JFrame(); frame.add(label);/*from ww w. j a v a 2s.c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel image = new JLabel("java2s.com"); image.setPreferredSize(new Dimension(2000, 2000)); JScrollPane js = new JScrollPane(image); js.setPreferredSize(new Dimension(200, 200)); JOptionPane.showMessageDialog(null, js); }
From source file:Main.java
public static void main(String[] args) { Color myColor = Color.RED; JLabel label = new JLabel("First Name"); label.setForeground(myColor.brighter()); JFrame frame = new JFrame(); frame.add(label);/* w w w. ja v a2 s . co m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:HelloWorldSwing.java
public static void main(String[] args) { JFrame frame = new JFrame("HelloWorldSwing"); final JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label);/* ww w. j a v a2s . co m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color myColor = new Color(0XFFFFFF); JLabel label = new JLabel("First Name"); label.setForeground(myColor);// w ww . jav a 2s.co m JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color myColor = Color.decode("0XFFFFFF"); JLabel label = new JLabel("First Name"); label.setForeground(myColor);/*from w ww . ja va 2 s . c o m*/ JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }