Пример #1
0
 public void paint(Graphics g) {
   if (comp != null) {
     width = comp.getWidth() / 6;
     height = comp.getHeight() * 2 / 3;
   }
   g.setColor(bgColor);
   g.fillRect(x, y, width, height);
   g.setColor(fgColor);
   g.setFont(font);
   g.drawString(strTray, x / 2 + width / 2, y + height + 10);
   super.paint(g);
 }
Пример #2
0
 public void paint(Graphics g) {
   Dimension d = getSize();
   int j = line_ascent + btnMarginHeight;
   for (int k = 0; k < num_lines; k++) {
     int i = (d.width - line_widths[k]) / 2;
     g.drawString(lines[k], i, j);
     j += line_height;
   }
   if (btnPlacement == 1 || btnPlacement == 2) setSize(d.width, max_height);
 }
Пример #3
0
 public void paint(Graphics g) {
   super.paint(g);
   if (!isEditing) return;
   Dimension psize = getPreferredSize();
   if (isFocused) g.setColor(Color.yellow);
   else g.setColor(Color.green);
   g.drawLine(0, 0, psize.width, 0);
   g.drawLine(0, 0, 0, psize.height);
   g.drawLine(0, psize.height - 1, psize.width - 1, psize.height - 1);
   g.drawLine(psize.width - 1, 0, psize.width - 1, psize.height - 1);
 }