swing:color
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| swing:color [2015/05/05 13:17] – [Παράδειγμα χρήση της κλάσης Color] gthanos | swing:color [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| Για παράδειγμα, | Για παράδειγμα, | ||
| <code java> | <code java> | ||
| - | this.getContnetPane().setBackground(Color.BLUE); | + | // assuming you are inside the constructor or a non static method of the frame |
| + | this.getContentPane().setBackground(Color.BLUE); | ||
| </ | </ | ||
| Line 54: | Line 55: | ||
| ====== Παράδειγμα χρήση της κλάσης Color ====== | ====== Παράδειγμα χρήση της κλάσης Color ====== | ||
| - | Παρακάτω δίνουμε ένα παράδειγμα όπου χρησιμοποιούμε | + | Παρακάτω δίνουμε ένα παράδειγμα όπου χρησιμοποιούμε την κλάση [[https:// |
| - | <code java PanelDemo.java> | + | <code java ColorDemo.java> |
| import javax.swing.*; | import javax.swing.*; | ||
| import java.awt.*; | import java.awt.*; | ||
| import java.awt.event.*; | import java.awt.event.*; | ||
| - | public class PanelDemo | + | public class ColorDemo |
| public static final int WIDTH = 300; | public static final int WIDTH = 300; | ||
| public static final int HEIGHT = 200; | public static final int HEIGHT = 200; | ||
| Line 70: | Line 71: | ||
| | | ||
| public static void main(String args[]) { | public static void main(String args[]) { | ||
| - | | + | |
| gui.setVisible(true); | gui.setVisible(true); | ||
| } | } | ||
| | | ||
| - | public | + | public |
| - | super(" | + | super(" |
| setSize(WIDTH, | setSize(WIDTH, | ||
| setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
| Line 139: | Line 140: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | | Προηγούμενο: | ||
swing/color.1430831822.txt.gz · Last modified: 2015/05/05 12:17 (external edit)
