示例#1
0
  private NewPanel() {

    setBackground(Color.decode(ColorManager.getCreatePanelBackground()));
    Dimension dim = new Dimension(200, 120);
    setPreferredSize(dim);
    JTextField text = new JTextField("", 15);
    SubmitButton submit = new SubmitButton(text);
    setBorder(
        BorderFactory.createMatteBorder(
            5, 5, 5, 5, Color.decode(ColorManager.getCreatePanelBorder())));
    JLabel label = new JLabel("Create a new button");
    label.setForeground(Color.decode(ColorManager.getCreatePanelText()));
    add(label);
    add(text);
    add(submit);
  }
示例#2
0
 // convert color name in Java Color object
 public Color getColour(String name) {
   if (name.equals("red")) {
     return Color.red;
   } else if (name.equals("blue")) {
     return Color.blue;
   } else if (name.equals("black")) {
     return Color.black;
   } else if (name.equals("cyan")) {
     return Color.cyan;
   } else if (name.equals("dark gray")) {
     return Color.darkGray;
   } else if (name.equals("gray")) {
     return Color.gray;
   } else if (name.equals("light gray")) {
     return Color.lightGray;
   } else if (name.equals("green")) {
     return Color.gray;
   } else if (name.equals("magenta")) {
     return Color.magenta;
   } else if (name.equals("orange")) {
     return Color.orange;
   } else if (name.equals("pink")) {
     return Color.pink;
   } else if (name.equals("white")) {
     return Color.white;
   } else if (name.equals("yellow")) {
     return Color.yellow;
   }
   try {
     // see if the colour is expressed in
     // 0xAABBCC format for RGB...
     return Color.decode(name);
   } catch (NumberFormatException e) {
   }
   // no, ok bail then ... but this will certainly
   // through an exception
   return null;
 }
示例#3
0
  private void readConfig() {
    config = configService.getState();

    coords.setPixelsPerLine(config.pixelsPerLine);
    viewportColor = Color.decode("#" + config.viewportColor);
  }