Created
February 26, 2019 12:00
-
-
Save tuxcuiabano/8eeebf742eb1ca1b82c34044db39db54 to your computer and use it in GitHub Desktop.
Programa que lê duas variáveis .....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package deitel14; | |
import java.awt.FlowLayout; | |
import javax.swing.Icon; | |
import javax.swing.ImageIcon; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.SwingConstants; | |
/** | |
* | |
* @author tuxcuiabano | |
*/ | |
public class LabelFrame extends JFrame{ | |
private JLabel label1; | |
private JLabel label2; | |
private JLabel label3; | |
public LabelFrame() | |
{ | |
super( "Testando JLabel" ); | |
setLayout( new FlowLayout() ); | |
label1 = new JLabel( "Label com texto" ); | |
label1.setToolTipText( "Essa é a label1" ); | |
add( label1 ); | |
Icon bug = new ImageIcon( getClass().getResource( "bug1.png" ) ); | |
label2 = new JLabel( "Label com texto e ícone", bug, | |
SwingConstants.LEFT ); | |
label2.setToolTipText( "Essa é a label2" ); | |
add( label2 ); | |
label3 = new JLabel(); | |
label3.setText( "Label com ícone e texto alinhado embaixo" ); | |
label3.setIcon( bug ); | |
label3.setHorizontalTextPosition( SwingConstants.CENTER ); | |
label3.setVerticalTextPosition( SwingConstants.BOTTOM ); | |
label3.setToolTipText( "Essa é a label3" ); | |
add( label3 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment