This shows you the differences between two versions of the page.
poo:breviare:breviar-10 [2018/11/27 17:38] matei.teodorescu |
poo:breviare:breviar-10 [2020/12/10 13:47] (current) carmen.odubasteanu |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Breviar ====== | ====== Breviar ====== | ||
- | ===== Laborator 10 - Interfete ===== | + | ===== Laborator 10 - Interfete grafice ===== |
* Responsabil: [[mihai.nan.cti@gmail.com|Mihai Nan]] | * Responsabil: [[mihai.nan.cti@gmail.com|Mihai Nan]] | ||
Line 40: | Line 40: | ||
super(text); | super(text); | ||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
- | setMinimumSize(new Dimension (3 0 0, 2 0 0)); | + | setMinimumSize(new Dimension (300, 200)); |
getContentPane().setBackground (Color.blue); | getContentPane().setBackground (Color.blue); | ||
setLayout(new SpringLayout()); | setLayout(new SpringLayout()); | ||
Line 79: | Line 79: | ||
super(text); | super(text); | ||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
- | setMinimumSize(new Dimension(3 0 0, 2 0 0)); | + | setMinimumSize(new Dimension(300, 200)); |
getContentPane().setBackground(Color.blue); | getContentPane().setBackground(Color.blue); | ||
setLayout(new SpringLayout()); | setLayout(new SpringLayout()); | ||
Line 95: | Line 95: | ||
@Override | @Override | ||
public void actionPerformed(ActionEvent e){ | public void actionPerformed(ActionEvent e){ | ||
- | JButton button = (JButton)e.getSource(); | + | |
- | if (button.getText().equals("Apasa")){ | + | /* |
+ | JButton button = (JButton)e.getSource(); | ||
+ | if (button.getText().equals("Apasa")) // valabil daca aveam mai multe butoane ascultate de acest ascultator | ||
+ | */ | ||
System.out.println("Butonul a fost apasat ! " ) ; | System.out.println("Butonul a fost apasat ! " ) ; | ||
- | } | ||
} | } | ||
} | } | ||
Line 118: | Line 120: | ||
super(text); | super(text); | ||
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); | setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); | ||
- | setMinimumSize(new Dimension(3 0 0, 2 0 0)); | + | setMinimumSize(new Dimension(300, 200)); |
getContentPane().setBackground(Color.blue); | getContentPane().setBackground(Color.blue); | ||
setLayout(new FlowLayout()); | setLayout(new FlowLayout()); | ||
Line 138: | Line 140: | ||
@Override | @Override | ||
public void actionPerformed(ActionEvent e){ | public void actionPerformed(ActionEvent e){ | ||
+ | /* | ||
JButton button = (JButton)e.getSource(); | JButton button = (JButton)e.getSource(); | ||
- | if (button.getText().equals("Apasa")){ | + | if (button.getText().equals("Apasa")) // valabil daca aveam mai multe butoane ascultate de acest ascultator |
- | System.out.println(user.getText() + pass.getText()); | + | */ |
- | } | + | System.out.println(user.getText() + pass.getText()); |
} | } | ||
} | } | ||
Line 169: | Line 172: | ||
class Text extends JFrame{ | class Text extends JFrame{ | ||
private JTextArea textArea; | private JTextArea textArea; | ||
- | private JScrollPanescroll; | + | private JScrollPane scroll; |
public Text (String text){ | public Text (String text){ | ||
super(text); | super(text); | ||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
- | setMinimumSize(new Dimension(3 0 0, 2 0 0)); | + | setMinimumSize(new Dimension(300, 200)); |
getContentPane().setBackground(Color.blue); | getContentPane().setBackground(Color.blue); | ||
setLayout(new FlowLayout()); | setLayout(new FlowLayout()); | ||
- | textArea = new JTextArea(2 0 0, 1 0 0); | + | textArea = new JTextArea(200, 100); |
textArea.setLineWrap(true); | textArea.setLineWrap(true); | ||
textArea.setWrapStyleWord(true); | textArea.setWrapStyleWord(true); |