Public Methods | |
| PropertyComponent (PropertyDialog dlg) | |
| PropertyComponent (String t) | |
| void | setText (String t) |
| void | paint (Graphics g) |
| void | mouseClicked (MouseEvent e) |
| void | mouseEntered (MouseEvent e) |
| void | mouseExited (MouseEvent e) |
| void | mousePressed (MouseEvent e) |
| void | mouseReleased (MouseEvent e) |
|
|
00022 {
00023 setOpaque(true);
00024 setBackground(Color.red);
00025 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
00026 _dialog = dlg;
00027 addMouseListener(this);
00028 }
|
|
|
00031 {
00032 setOpaque(true);
00033 setBackground(Color.red);
00034 //setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
00035 _dialog = null;
00036 _title = t;
00037 //addMouseListener(this);
00038 }
|
|
|
00041 {
00042 _title = t;
00043 //repaint();
00044 }
|
|
|
00047 {
00048 Dimension s = getSize();
00049
00050 if(_dialog != null) {
00051 g.setColor(Color.red);
00052 g.fillRect(0, 0, s.width, s.height); // setOpaque doesn't work !
00053 g.setColor(Color.black);
00054 g.drawRect(0, 0, s.width-1, s.height-1);
00055 g.setColor(Color.white);
00056
00057 String text = _dialog.getText();
00058 FontMetrics fm = g.getFontMetrics();
00059 int w = fm.stringWidth(text);
00060 g.drawString(text, (s.width - w)/2, s.height - 4);
00061 }else {
00062 g.setColor(Color.green);
00063 String text = _title;
00064 FontMetrics fm = g.getFontMetrics();
00065 int w = fm.stringWidth(text);
00066 g.drawString(text, (s.width - w)/2, s.height - 4);
00067 }
00068 }
|
|
|
00071 {
00072 _dialog.show();
00073 repaint();
00074 }
|
|
|
00076 {}
|
|
|
00077 {}
|
|
|
00078 {}
|
|
|
00079 {}
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001