April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Métodos de JLabel
nvoid setText(String text)
nvoid setIcon(Icon icon)
nvoid setIconTextGap(int gap)
nvoid setHorizontalAlignment(int a)
nvoid setVerticalAlignment(int a)
nvoid setLabelFor(Component c)
nvoid setDisplayedMnemonic(int key)
nvoid setDisplayedMnemonic(char aChar)
n
nExemplo de JLabel
nJFrame f = new JFrame("Teste");
nf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
nJLabel l = new JLabel("Isso é um JLabel");
nl.setIcon(new ImageIcon("javalogo.gif"));
nContainer cp = f.getContentPane(); cp.add(l);
nf.pack();
nf.show();