コード例 #1
0
 public void updateKeyboardUI() {
   if (Skin.VIETNAMESE_KEY.isEnabled()) {
     chkVietnamese.setText(" V ");
     chkVietnamese.setBackground(Color.yellow);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.red, 1));
   } else {
     chkVietnamese.setText(" E ");
     chkVietnamese.setBackground(Color.cyan);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.blue, 1));
   }
 }
コード例 #2
0
  private void jbInit() throws Exception {
    // this.setResizable(false);
    this.setSize(ancho, alto);
    this.setLocation(0, 0);

    // this.setUndecorated(true);
    // this.getContentPane().setLayout(null);

    // limites de componentes
    labelFondo.setBounds(
        new Rectangle((int) (ancho / 5), 2 * (alto / 6), (int) (ancho / 1.5), alto / 4));
    botonCancelar.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonCancelar.setBorder(null);
    // botonAceptar.setBounds(new Rectangle(0, 0, 100, 30));
    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.15 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);
    textNombre.setFont(new java.awt.Font("Serif", 3, 15));
    textNombre.setBounds(
        new Rectangle((int) (2.5 * (ancho / 5)), (int) (1.5 * (alto / 4)), ancho / 5, alto / 25));
    textNombre.addKeyListener(new PanelNick_textNombre_keyAdapter(this));

    textContra.setFont(new java.awt.Font("Serif", 3, 15));
    textContra.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (1.65 * (alto / 4)) + 20, ancho / 8, alto / 25));

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon("../imagenes/introduceNick.jpg"));
    botonCancelar.setIcon(new ImageIcon("../imagenes/botoncancelar.jpg"));
    botonCancelar.addMouseListener(new PanelNick_botonCancelar_mouseAdapter(this));
    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelNick_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel
    this.add(textContra, null);
    this.add(botonCancelar, null);
    this.add(botonAceptar, null);
    this.add(textNombre, null);
    this.add(labelFondo, null);

    // acciones de botones
    botonAceptar.addActionListener(new PanelNick_botonAceptar_actionAdapter(this));
    botonCancelar.addActionListener(new PanelNick_botonCancelar_actionAdapter(this));
  }
コード例 #3
0
  /**
   * Description of the Method
   *
   * @exception Exception Description of Exception
   */
  private void jbInit() throws Exception {

    this.setLayout(null);
    this.setSize(700, 500);
    this.setLocation(0, 0);

    // limites de componentes
    labelFondo.setBounds(new Rectangle((int) (ancho / 3.5), 2 * (alto / 6), ancho / 2, alto / 4));

    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.4 * (ancho / 5)), (int) (1.9 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon(Imagen));

    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelGenerico_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel

    this.add(botonAceptar, null);
    this.add(labelFondo, null);
    this.setBackground(SystemColor.menuText);

    // acciones de botones
    botonAceptar.addActionListener(new PanelGenerico_botonAceptar_actionAdapter(this));
  }
コード例 #4
0
    public IconButton(Icon[] icons) {
      this.icons = icons;
      super.setBorder(emptyBorder);
      setState(UP);
      setContentAreaFilled(false);

      addMouseListener(this);
    }
コード例 #5
0
 private void initButton(JButton button) {
   button.setText("");
   button.setBorder(RAISED_BORDER);
   button.setBorderPainted(false);
   button.setFocusPainted(false);
   button.setHorizontalAlignment(SwingConstants.CENTER);
   button.setVerticalAlignment(SwingConstants.CENTER);
 }
コード例 #6
0
  /*
   * We do custom rendering of the arrow button because there are too many
   * hacks in each theme's combobox UI.
   * We also cannot forward paint of the arrow button to a stock combobox
   * because each LAF and theme may render different parts of the
   * arrow button with different sizes.  For example, in Mac, the arrow button is
   * drawn with a border (the responsibility of the border
   * near the arrow button belongs to the button).  However in IntelliJ and Darcula,
   * the arrow button is drawn without a border and it's the responsibility of the
   * outer control to draw a border.  In addition, darcula renders part of the arrow
   * button outside the button.  That is, the arrow button looks like it's about 20x20,
   * but actually, it's only 16x16, with part of the rendering done via paint on the combobox itself.
   * So while this creates some small inconsistencies,
   * it reduces the chance of a major UI issue such as a completely poorly drawn button with a double border.
   */
  private JButton createArrowButton() {
    final Color bg = getBackground();
    final Color fg = getForeground();
    JButton button =
        new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {

          @Override
          public void paint(Graphics g2) {
            final Graphics2D g = (Graphics2D) g2;
            final GraphicsConfig config = new GraphicsConfig(g);

            final int w = getWidth();
            final int h = getHeight();
            g.setColor(getButtonBackgroundColor());
            g.fillRect(0, 0, w, h);
            g.setColor(getArrowColor());
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(
                RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
            g.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
            final int midx = (int) Math.ceil((w - 1) / 2.0) + 1;
            final int midy = (int) Math.ceil(h / 2.0);
            final Path2D.Double path = new Path2D.Double();
            path.moveTo(midx - 4, midy - 2);
            path.lineTo(midx + 4, midy - 2);
            path.lineTo(midx, midy + 4);
            path.lineTo(midx - 4, midy - 2);
            path.closePath();
            g.fill(path);
            g.setColor(getBorderColor());
            if (UIUtil.isUnderGTKLookAndFeel()) {
              g.drawLine(0, 1, 0, h - 2);
              g.drawLine(0, 1, w - 2, 1);
              g.drawLine(0, h - 2, w - 2, h - 2);
              g.drawLine(w - 2, 1, w - 2, h - 2);
            } else {
              g.drawLine(0, 0, 0, h);
            }
            config.restore();
          }

          @Override
          public Dimension getPreferredSize() {
            int newSize =
                CustomizableComboBox.this.getHeight()
                    - (CustomizableComboBox.this.getInsets().bottom
                        + CustomizableComboBox.this.getInsets().top);
            return new Dimension(newSize, newSize);
          }
        };
    button.setOpaque(false);
    button.setFocusable(false);
    button.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 1));

    return button;
  }
コード例 #7
0
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
コード例 #8
0
ファイル: GameBoard.java プロジェクト: LaytonW/CardGame
  /** Constructor for allocating memory and simple initializing. */
  public GameBoard() {
    dealerPanel = new JPanel();
    playerPanel = new JPanel();
    controlPanel = new JPanel();
    money = new JLabel();
    record = new JLabel();
    inputImage = new JLabel(new ImageIcon("res/INPUT.gif"));
    moneyLabel = new JLabel(new ImageIcon("res/MONEY.gif"));
    betLabel = new JLabel(new ImageIcon("res/MAKE_YOUR_BET.gif"));
    recordLabel = new JLabel(new ImageIcon("res/BEST_SCORE.gif"));
    betButton = new JButton(new ImageIcon("res/BET.gif"));
    resultButton = new JButton(new ImageIcon("res/RESULT.gif"));
    betInput = new JTextField();

    try {
      recordReader = new BufferedReader(new FileReader("res/record"));
      bestScore = Integer.parseInt(recordReader.readLine());
      recordReader.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

    inputImage.setLayout(new BorderLayout());
    controlPanel.setLayout(new FlowLayout());

    betInput.setHorizontalAlignment(JTextField.CENTER);
    betButton.setBorder(BorderFactory.createEmptyBorder());
    betButton.setContentAreaFilled(false);
    resultButton.setBorder(BorderFactory.createEmptyBorder());
    resultButton.setContentAreaFilled(false);
    resultButton.setEnabled(false);
    betButton.addMouseListener(new BetListener());
    resultButton.addMouseListener(new ResultListener());
    betInput.setOpaque(false);
    betInput.setBorder(BorderFactory.createEmptyBorder());
    money.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    record.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    setOpaque(false);

    initGame();
    initRound();
  }
コード例 #9
0
ファイル: AdminLogin.java プロジェクト: danteata/sms
 public void createDesiredBorder(JButton jbtn) {
   jbtn.setBorder(
       javax.swing.BorderFactory.createCompoundBorder(
           javax.swing.BorderFactory.createCompoundBorder(
               javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED),
               javax.swing.BorderFactory.createCompoundBorder(
                   javax.swing.BorderFactory.createMatteBorder(
                       2, 2, 2, 2, new java.awt.Color(0, 0, 0)),
                   javax.swing.BorderFactory.createBevelBorder(
                       javax.swing.border.BevelBorder.RAISED))),
           javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
 }
コード例 #10
0
 public ButtonsRenderer(RemoveButtonComboBox<E> comboBox) {
   super(new BorderLayout(0, 0));
   this.comboBox = comboBox;
   label.setOpaque(false);
   setOpaque(true);
   add(label);
   deleteButton.setBorder(BorderFactory.createEmptyBorder());
   deleteButton.setFocusable(false);
   deleteButton.setRolloverEnabled(false);
   deleteButton.setContentAreaFilled(false);
   add(deleteButton, BorderLayout.EAST);
 }
コード例 #11
0
ファイル: MancalaPanel.java プロジェクト: meckila/Mancala
  // Panel below board (Contains Label Indicating Player 1's turn
  private JPanel southWindowPanel() {
    JPanel lab1Panel = new JPanel();
    lab1Panel.setLayout(new BorderLayout());
    lab1Panel.setPreferredSize(new Dimension(300, 150));
    lab1Panel.setOpaque(false);
    statusLabel1 = new JLabel("Player 1's Turn", JLabel.CENTER);
    statusLabel1.setForeground(new Color(203, 159, 0));
    statusLabel1.setFont(new Font("Belta Regular", Font.ITALIC, 45));

    lab1Panel.add(statusLabel1, BorderLayout.CENTER);

    JPanel eastContainer = new JPanel();
    eastContainer.setLayout(new BorderLayout());
    eastContainer.setOpaque(false);
    eastContainer.setPreferredSize(new Dimension(200, 300));

    JPanel btnPanel = new JPanel();
    btnPanel.setOpaque(false);
    btnPanel.setPreferredSize(new Dimension(300, 60));
    eastContainer.add(btnPanel, BorderLayout.SOUTH);

    // Add help button to panel
    instructBtn.setPreferredSize(new Dimension(50, 40));
    instructBtn.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    instructBtn.addActionListener(new ButtonListener());
    btnPanel.add(instructBtn);

    // Add restart button to panel
    restartBtn.setPreferredSize(new Dimension(100, 40));
    restartBtn.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    restartBtn.addActionListener(new ButtonListener()); // Add Action Listener (Reset Game)
    btnPanel.add(restartBtn);

    JPanel westContainer = new JPanel();
    westContainer.setPreferredSize(new Dimension(200, 300));
    westContainer.setOpaque(false);
    lab1Panel.add(westContainer, BorderLayout.WEST);
    lab1Panel.add(eastContainer, BorderLayout.EAST);
    return lab1Panel;
  }
コード例 #12
0
  private JButton createButton(final Commontags commontag) {

    if (mapButtons.containsKey(commontag)) {
      OPDE.debug("shortcut");
      return mapButtons.get(commontag);
    }

    final JButton jButton =
        new JButton(
            commontag.getText(),
            editmode ? SYSConst.icon16tagPurpleDelete2 : SYSConst.icon16tagPurple);
    jButton.setFont(SYSConst.ARIAL12);
    jButton.setBorder(new RoundedBorder(10));
    jButton.setHorizontalTextPosition(SwingConstants.LEADING);
    jButton.setForeground(SYSConst.purple1[SYSConst.dark3]);

    if (editmode) {

      jButton.addActionListener(
          e -> {
            listSelectedTags.remove(commontag);
            mapButtons.remove(commontag);
            SwingUtilities.invokeLater(
                () -> {
                  removeAll();

                  add(txtTags);
                  if (btnPickTags != null) {
                    add(btnPickTags);
                  }
                  int tagnum = 1;

                  for (JButton btn : mapButtons.values()) {
                    if (tagnum % MAXLINE == 0) {
                      add(btn, RiverLayout.LINE_BREAK);
                    } else {
                      add(btn, RiverLayout.LEFT);
                    }
                    tagnum++;
                  }

                  remove(jButton);
                  revalidate();
                  repaint();
                  notifyListeners(commontag);
                });
          });
    }
    mapButtons.put(commontag, jButton);

    return jButton;
  }
コード例 #13
0
    /** Constructor. */
    public FileChooserCellEditor() {
      super(new JTextField());
      setClickCountToStart(CLICK_COUNT_TO_START);

      // Using a JButton as the editor component
      button = new JButton();
      button.setBackground(Color.white);
      button.setFont(button.getFont().deriveFont(Font.PLAIN));
      button.setBorder(null);

      // Dialog which will do the actual editing
      fileChooser = new JFileChooser();
      fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }
コード例 #14
0
  public Panel_AjoutTour(Game jeu, EcouteurDePanelTerrain edpt, int largeur, int hauteur) {
    this.jeu = jeu;
    this.edpt = edpt;

    setBackground(LookInterface.COULEUR_DE_FOND_PRI);

    // ---------------------
    // -- panel des tours --
    // ---------------------
    JPanel pTours = new JPanel(new GridLayout(2, 0));
    pTours.setOpaque(false);
    pTours.setPreferredSize(new Dimension(largeur, hauteur));

    String titrePrixAchat = Langue.getTexte(Langue.ID_TXT_PRIX_ACHAT);

    boutonsTours.add(bTourArcher);
    bTourArcher.setToolTipText(titrePrixAchat + " : " + Tower_Archer.PRIX_ACHAT);

    boutonsTours.add(bTourCanon);
    bTourCanon.setToolTipText(titrePrixAchat + " : " + Tower_Canon.PRIX_ACHAT);

    boutonsTours.add(bTourAntiAerienne);
    bTourAntiAerienne.setToolTipText(titrePrixAchat + " : " + Tower_AntiAerial.PRIX_ACHAT);

    boutonsTours.add(bTourDeGlace);
    bTourDeGlace.setToolTipText(titrePrixAchat + " : " + Tower_Ice.PRIX_ACHAT);

    boutonsTours.add(bTourElectrique);
    bTourElectrique.setToolTipText(titrePrixAchat + " : " + Tower_Electric.PRIX_ACHAT);

    boutonsTours.add(bTourDeFeu);
    bTourDeFeu.setToolTipText(titrePrixAchat + " : " + Tower_Fire.PRIX_ACHAT);

    boutonsTours.add(bTourDAir);
    bTourDAir.setToolTipText(titrePrixAchat + " : " + Tower_Air.PRIX_ACHAT);

    boutonsTours.add(bTourDeTerre);
    bTourDeTerre.setToolTipText(titrePrixAchat + " : " + Tower_Earth.PRIX_ACHAT);

    for (JButton bTour : boutonsTours) {
      bTour.addActionListener(this);
      bTour.setBorder(new EmptyBorder(5, 5, 5, 5));
      ManageFonts.setStyle(bTour);
      pTours.add(bTour);
    }

    miseAJour();

    add(pTours, BorderLayout.CENTER);
  }
コード例 #15
0
ファイル: SimpleBorder.java プロジェクト: kelindev/javaStudy
  public static void main(String arg[]) {

    JFrame f = new JFrame("SimpleBorder");
    Container content = f.getContentPane();
    JButton b = new JButton();
    b.setBorder(BorderFactory.createLineBorder(Color.blue, 10));
    content.add(b);
    f.setSize(200, 150);
    f.show();

    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
コード例 #16
0
ファイル: SpinnerUI.java プロジェクト: ieugen/squirrel-sql
  /**
   * Create a component that will replace the spinner models value with the object returned by
   * <code>spinner.getNextValue</code>. By default the <code>nextButton</code> is a JButton who's
   * <code>ActionListener</code> updates it's <code>JSpinner</code> ancestors model. If a nextButton
   * isn't needed (in a subclass) then override this method to return null.
   *
   * @return a component that will replace the spinners model with the next value in the sequence,
   *     or null
   * @see #installUI
   * @see #createPreviousButton
   */
  protected Component createNextButton() {
    Component tmpButton = super.createNextButton();

    if (tmpButton instanceof JButton) {
      JButton result = new ArrowButton(SwingConstants.NORTH);
      ((ArrowButton) result).setDrawBottomBorder(false);

      result.setBorder(
          BorderFactory.createMatteBorder(1, 1, 0, 1, UIManager.getColor("Button.borderColor")));
      ActionListener al[] = ((JButton) tmpButton).getActionListeners();
      for (int i = 0; i < al.length; i++) result.addActionListener(al[i]);

      MouseListener ml[] = ((JButton) tmpButton).getMouseListeners();
      for (int i = 0; i < ml.length; i++) result.addMouseListener(ml[i]);

      return result;
    } else return tmpButton;
  }
コード例 #17
0
  private static JButton createButton(String accessibleName, Icon icon, Action action) {
    JButton button =
        new JButton() {
          boolean mouseOverButton = false;

          {
            enableEvents(AWTEvent.MOUSE_EVENT_MASK);
            addMouseListener(
                new MouseAdapter() {
                  @Override
                  public void mouseEntered(MouseEvent e) {
                    mouseOverButton = true;
                    repaint();
                  }

                  @Override
                  public void mouseExited(MouseEvent e) {
                    mouseOverButton = false;
                    repaint();
                  }
                });
          }

          @Override
          protected void paintComponent(Graphics g) {
            final Window window = SwingUtilities.windowForComponent(this);
            float alpha = window.isActive() && mouseOverButton ? 1f : 0.5f;
            final GraphicsConfig config = GraphicsUtil.paintWithAlpha(g, alpha);
            getIcon().paintIcon(this, g, 0, 0);
            config.restore();
          }
        };
    button.setFocusPainted(false);
    button.setFocusable(false);
    button.setOpaque(false);
    button.putClientProperty("paintActive", Boolean.TRUE);
    button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
    button.setBorder(JBUI.Borders.empty());
    button.setText(null);
    button.setAction(action);
    button.setIcon(icon);
    return button;
  }
コード例 #18
0
  // Takes resource name and returns button
  public JButton createButton(String name, String toolTip) {

    // load the image
    String imagePath = "./resources/" + name + ".png";
    ImageIcon iconRollover = new ImageIcon(imagePath);
    int w = iconRollover.getIconWidth();
    int h = iconRollover.getIconHeight();

    // get the cursor for this button
    Cursor cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);

    // make translucent default image
    Image image = createCompatibleImage(w, h, Transparency.TRANSLUCENT);
    Graphics2D g = (Graphics2D) image.getGraphics();
    Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .5f);
    g.setComposite(alpha);
    g.drawImage(iconRollover.getImage(), 0, 0, null);
    g.dispose();
    ImageIcon iconDefault = new ImageIcon(image);

    // make a pressed image
    image = createCompatibleImage(w, h, Transparency.TRANSLUCENT);
    g = (Graphics2D) image.getGraphics();
    g.drawImage(iconRollover.getImage(), 2, 2, null);
    g.dispose();
    ImageIcon iconPressed = new ImageIcon(image);

    // create the button
    JButton button = new JButton();
    button.addActionListener(this);
    button.setIgnoreRepaint(true);
    button.setFocusable(false);
    button.setToolTipText(toolTip);
    button.setBorder(null);
    button.setContentAreaFilled(false);
    button.setCursor(cursor);
    button.setIcon(iconDefault);
    button.setRolloverIcon(iconRollover);
    button.setPressedIcon(iconPressed);

    return button;
  }
コード例 #19
0
ファイル: Spacer.java プロジェクト: grimtraveller/LightZone
  Spacer(ZoneModel model, int index, SpacerHandle knobHandle) {
    this.model = model;
    this.index = index;
    this.knobHandle = knobHandle;

    knobPainter = new KnobPainter(this);

    setOpaque(false);
    setCursor(SliderCursor);

    initKeyMaps();

    Icon icon = getIcon("unstick");
    Icon pressedIcon = getIcon("unstickPressed");
    Icon highlightIcon = getIcon("unstickHighlight");
    unstickButton = new JButton(icon);
    unstickButton.setSize(icon.getIconWidth(), icon.getIconHeight());
    unstickButton.setPressedIcon(pressedIcon);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setRolloverIcon(highlightIcon);
    unstickButton.setBorder(null);
    unstickButton.putClientProperty(SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
    unstickButton.setBorderPainted(false);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setOpaque(false);
    unstickButton.setCursor(ClickCursor);
    unstickButton.setFocusable(false);
    unstickButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Spacer.this.model.removePoint(Spacer.this.index);
          }
        });
    if (model.containsPoint(index)) {
      add(unstickButton);
    }
    model.addZoneModelListener(this);

    setFocusable(true);
    addFocusListener(this);
    addMouseListener(this);
  }
コード例 #20
0
ファイル: MyDateChooseBtn.java プロジェクト: singleD/se2
    private void initButton() {
      int actionCommandId = 1;
      for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 7; j++) {
          JButton numberButton = new JButton();
          numberButton.setBorder(BorderFactory.createEmptyBorder());
          numberButton.setHorizontalAlignment(SwingConstants.CENTER);
          numberButton.setActionCommand(String.valueOf(actionCommandId));

          numberButton.addMouseListener(this);

          numberButton.setBackground(palletTableColor);
          numberButton.setForeground(dateFontColor);
          numberButton.setText(String.valueOf(actionCommandId));
          numberButton.setPreferredSize(new Dimension(25, 25));
          daysButton[i][j] = numberButton;
          actionCommandId++;
        }
      }
    }
コード例 #21
0
 public MultiValueResultView() {
   super();
   setLayout(new BorderLayout(5, 5));
   add(new JScrollPane(list), BorderLayout.CENTER);
   JPanel bPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
   logButton.setBorder(null);
   bPane.add(logButton);
   add(bPane, BorderLayout.SOUTH);
   logButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           int pos = list.getSelectedIndex();
           if (pos < logs.size()) {
             DerivationLogViewer.displayUsedRules(logs.get(pos), MultiValueResultView.this);
           }
         }
       });
   logButton.setEnabled(false);
   list.addListSelectionListener(
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent e) {
           int pos = list.getSelectedIndex();
           logButton.setEnabled(pos < logs.size());
         }
       });
   list.addMouseListener(
       new MouseAdapter() {
         // to open derivation log on double click
         public void mouseClicked(MouseEvent e) {
           int pos = list.getSelectedIndex();
           if (e.getClickCount() > 1 && pos < logs.size()) {
             DerivationLogViewer.displayUsedRules(logs.get(pos), MultiValueResultView.this);
           }
         }
       });
 }
コード例 #22
0
  Usermaster() {
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    x = dim.width;
    y = dim.height;
    setSize(x, y);
    setUndecorated(true);

    Container c = getContentPane();

    center =
        new JPanel() {
          public void paintComponent(Graphics g) {
            Toolkit kit = Toolkit.getDefaultToolkit();
            Image img = kit.getImage("Image/user.jpg");
            MediaTracker t = new MediaTracker(this);
            t.addImage(img, 0);
            while (true) {
              try {
                t.waitForAll();
                break;
              } catch (Exception ee) {
              }
            }
            g.drawImage(img, 0, 0, x, y, null);
          }
        };

    c.add(center);
    center.setLayout(null);

    titleLb =
        new JLabel(
            "<html><body ><font size='5'><b><i>&nbsp;&nbsp; User Name &nbsp;&nbsp;</b></i></font></body></html>");
    titleLb.setForeground(new Color(10, 110, 255));
    titleLb.setBounds(x / 2 + 50, x / 4, 150, 50);
    center.add(titleLb);

    output =
        new JLabel(
            "<html><body ><font size='5'><b><i>&nbsp;&nbsp; OUTPUT &nbsp;&nbsp;</b></i></font></body></html>");
    output.setForeground(Color.white);
    output.setBounds(x / 2 - 250, x / 6, 150, 50);
    center.add(output);

    login = new JButton(new ImageIcon("Image/logBut.gif"));
    login.setBorder(BorderFactory.createRaisedBevelBorder());
    login.setBounds(x / 2 + 100, x / 2 - 70, 100, 100);
    login.setBackground(Color.white);

    pass = new JPasswordField();
    pass.setToolTipText("Enter The Password To Payroll System");
    login.requestFocus();
    pass.setBorder(BorderFactory.createRaisedBevelBorder());
    pass.setForeground(new Color(10, 110, 255));
    pass.setFont(new Font("Arial", Font.BOLD, 22));
    pass.setCaretColor(Color.red);
    pass.setBounds(x / 2 + 50, x / 3, 200, 35);
    center.add(pass);
    center.add(login);

    pass.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            output.setText(
                "<html><body ><font size='5'><b><i>&nbsp;&nbsp; OUTPUT &nbsp;&nbsp;</b></i></font></body></html>");
            output.setForeground(Color.white);
          }
        });

    try {
      clsConnection connect = new clsConnection();
      conn = connect.setConnection(conn, "", "");
    } catch (Exception e) {
    }

    login.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              st = conn.createStatement();
              rs = st.executeQuery("select * from img");
              while (rs.next()) {
                if (pass.getText().equals(rs.getString(3))) {
                  setVisible(false);
                  URL url = closeSystem.class.getResource("spacemusic.au");
                  click = Applet.newAudioClip(url);
                  click.play();
                  paro.setVisible(true);
                } else {
                  pass.setText("");
                  pass.requestFocus();
                  output.setText("Fell");
                  output.setFont(new Font("Arial", Font.BOLD, 36));
                  output.setForeground(Color.red);
                }
              }
            } catch (Exception er) {
              System.out.println("Sorry\n" + er);
            }
          }
        });
  }
コード例 #23
0
 private void setLookRaised(JButton button) {
   button.setBorder(RAISED_BORDER);
   button.setHorizontalAlignment(SwingConstants.CENTER);
   button.setVerticalAlignment(SwingConstants.CENTER);
   button.setBorderPainted(true);
 }
コード例 #24
0
  /** This method is called from within the constructor to initialize the form. */
  public void initComponents() {

    /** **************** The components ********************************* */
    firstPanel = new JPanel();
    firstPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 2));
    // If put to False: we see the container's background
    firstPanel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    firstPanel.setLayout(new GridLayout(4, 2, 3, 3));
    this.setLayout(new GridLayout(2, 1, 3, 3));
    this.add(firstPanel);

    proxyStackNameLabel = new JLabel("Proxy stack name:");
    proxyStackNameLabel.setToolTipText("The name of the stack to set");
    // Alignment of the text
    proxyStackNameLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    proxyStackNameLabel.setForeground(Color.black);
    // Size of the text
    proxyStackNameLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    proxyStackNameLabel.setOpaque(true);
    proxyStackNameLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    proxyStackNameLabel.setBorder(ProxyLauncher.labelBorder);
    proxyStackNameTextField = new JTextField(20);
    proxyStackNameTextField.setHorizontalAlignment(AbstractButton.CENTER);
    proxyStackNameTextField.setFont(new Font("Dialog", 0, 14));
    proxyStackNameTextField.setBackground(ProxyLauncher.textBackGroundColor);
    proxyStackNameTextField.setForeground(Color.black);
    proxyStackNameTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(proxyStackNameLabel);
    firstPanel.add(proxyStackNameTextField);

    proxyIPAddressLabel = new JLabel("Proxy IP address:");
    proxyIPAddressLabel.setToolTipText("The address of the proxy to set");
    // Alignment of the text
    proxyIPAddressLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    proxyIPAddressLabel.setForeground(Color.black);
    // Size of the text
    proxyIPAddressLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    proxyIPAddressLabel.setOpaque(true);
    proxyIPAddressLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    proxyIPAddressLabel.setBorder(ProxyLauncher.labelBorder);
    proxyIPAddressTextField = new JTextField(20);
    proxyIPAddressTextField.setHorizontalAlignment(AbstractButton.CENTER);
    proxyIPAddressTextField.setFont(new Font("Dialog", 0, 14));
    proxyIPAddressTextField.setBackground(ProxyLauncher.textBackGroundColor);
    proxyIPAddressTextField.setForeground(Color.black);
    proxyIPAddressTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(proxyIPAddressLabel);
    firstPanel.add(proxyIPAddressTextField);

    outboundProxyLabel = new JLabel("Next hop (IP:port/protocol):");
    outboundProxyLabel.setToolTipText(
        "Location where the message will be sent "
            + "if all the resolutions (DNS, router,...) fail. If not set: 404 will be replied");
    // Alignment of the text
    outboundProxyLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    outboundProxyLabel.setForeground(Color.black);
    // Size of the text
    outboundProxyLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    outboundProxyLabel.setOpaque(true);
    outboundProxyLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    outboundProxyLabel.setBorder(ProxyLauncher.labelBorder);
    outboundProxyTextField = new JTextField(20);
    outboundProxyTextField.setHorizontalAlignment(AbstractButton.CENTER);
    outboundProxyTextField.setFont(new Font("Dialog", 0, 14));
    outboundProxyTextField.setBackground(ProxyLauncher.textBackGroundColor);
    outboundProxyTextField.setForeground(Color.black);
    outboundProxyTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(outboundProxyLabel);
    firstPanel.add(outboundProxyTextField);

    routerClassLabel = new JLabel("The Router class name:");
    routerClassLabel.setToolTipText(
        "The class name (full java package name) of the router" + " used to forward the messages");
    // Alignment of the text
    routerClassLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    routerClassLabel.setForeground(Color.black);
    // Size of the text
    routerClassLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    routerClassLabel.setOpaque(true);
    routerClassLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    routerClassLabel.setBorder(ProxyLauncher.labelBorder);
    routerClassTextField = new JTextField(20);
    routerClassTextField.setHorizontalAlignment(AbstractButton.CENTER);
    routerClassTextField.setFont(new Font("Dialog", 0, 12));
    routerClassTextField.setBackground(ProxyLauncher.textBackGroundColor);
    routerClassTextField.setForeground(Color.black);
    routerClassTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(routerClassLabel);
    firstPanel.add(routerClassTextField);

    JPanel panel = new JPanel();
    // top, left, bottom, right
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 2));
    // If put to False: we see the container's background
    panel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    panel.setLayout(new BorderLayout());
    this.add(panel);

    JLabel lpLabel = new JLabel("Listening points list:");
    lpLabel.setVisible(true);
    lpLabel.setToolTipText("The listening points of the proxy");
    lpLabel.setHorizontalAlignment(AbstractButton.CENTER);
    lpLabel.setForeground(Color.black);
    lpLabel.setFont(new Font("Dialog", 1, 12));
    lpLabel.setOpaque(true);
    lpLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    lpLabel.setBorder(ProxyLauncher.labelBorder);
    panel.add(lpLabel, BorderLayout.NORTH);

    // this.add(listeningPointsList);
    JScrollPane scrollPane =
        new JScrollPane(
            listeningPointsList,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.add(scrollPane, BorderLayout.CENTER);

    thirdPanel = new JPanel();
    thirdPanel.setOpaque(false);
    // top, left, bottom, right
    thirdPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 5, 0));
    thirdPanel.setLayout(new GridLayout(1, 2, 3, 3));

    JButton addLPButton = new JButton(" Add ");
    addLPButton.setToolTipText("Add a listening point");
    addLPButton.setFocusPainted(false);
    addLPButton.setFont(new Font("Dialog", 1, 16));
    addLPButton.setBackground(ProxyLauncher.buttonBackGroundColor);
    addLPButton.setBorder(ProxyLauncher.buttonBorder);
    addLPButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            addLPButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(addLPButton);

    JButton removeLPButton = new JButton(" Remove ");
    removeLPButton.setToolTipText("Remove a listening point");
    removeLPButton.setFocusPainted(false);
    removeLPButton.setFont(new Font("Dialog", 1, 16));
    removeLPButton.setBackground(ProxyLauncher.buttonBackGroundColor);
    removeLPButton.setBorder(ProxyLauncher.buttonBorder);
    removeLPButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            removeLPButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(removeLPButton);

    panel.add(thirdPanel, BorderLayout.SOUTH);
  }
コード例 #25
0
ファイル: Gui.java プロジェクト: hygzhu/java-incremental-game
  // gui constructor
  public Gui() throws IOException {

    // sets frame text and features
    super("Doge Clicker 1.0");
    this.setIconImage(new ImageIcon("Images//doge.jpg").getImage());

    // initializes sound files
    Sounds.initialize();

    // gui dimensions and features
    setSize(1000, 700);
    setResizable(false);
    setLayout(null);
    Container c = getContentPane();
    c.setBackground(new Color(255, 255, 255));
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    // timer for doge per second run method runs every millisecond
    timer = new Timer();
    timer.schedule(new RemindTask(), 1000, 10);

    // bolded title
    title = new JLabel("Doge Clicker v1.0");
    title.setBounds(0, 0, getWidth(), 40);
    title.setFont(new Font("Comic Sans MS", Font.BOLD, 26));
    title.setForeground(Color.white);
    title.setHorizontalAlignment(JLabel.CENTER);
    add(title);

    // reads news.txt to have import text to array
    String filePath = "Data\\news.txt";
    BufferedReader fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < line.length; i++) {

      // reads lines and saves until done reading
      if ((line[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close(); // close file

    // read flavor text.txt to import text to array
    filePath = "Data\\flavourtext.txt";
    fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < flavourText.length; i++) {

      // reads lines until complety reading
      if ((flavourText[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close();

    // flavour label that pops up randomly when doge is clicked
    flavourClick = new JLabel("Wow! Such click!");
    flavourClick.setBounds(400, 100, getWidth(), getHeight());
    flavourClick.setFont(new Font("Comic Sans MS", Font.BOLD, 25));
    flavourClick.setForeground(Color.white);
    flavourClick.setOpaque(false);
    add(flavourClick);

    // label for achievements
    achievementText = new JLabel("These are your achievements");
    achievementText.setBounds(75, 2, getWidth(), 15);
    achievementText.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    achievementText.setForeground(Color.white);
    add(achievementText);

    // label for doge buying and click upgrades
    dogeProducers = new JLabel("Buy to make more doge");
    dogeProducers.setBounds(50, 160, getWidth(), 40);
    dogeProducers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeProducers.setForeground(Color.white);
    add(dogeProducers);
    dogeClickers = new JLabel("Miscellaneous upgrades wow");
    dogeClickers.setBounds(700, 160, getWidth(), 40);
    dogeClickers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClickers.setForeground(Color.white);
    add(dogeClickers);

    // doge click button
    dogeClick = new JButton(new ImageIcon("Images/doge.jpg"));
    dogeClick.addActionListener(this);
    dogeClick.setBounds(450, 100, 100, 100);
    dogeClick.setOpaque(false);
    dogeClick.setBorder(BorderFactory.createLineBorder(Color.black));
    dogeClick.setToolTipText("Each click gives you " + clickUpgrade + " doge. wow");
    add(dogeClick);

    // click multiplier
    clickMultiplier = new JLabel(multiplier + "x");
    clickMultiplier.setBounds(570, 120, getWidth(), 50);
    clickMultiplier.setFont(new Font("Comic Sans MS", Font.BOLD, 30));
    clickMultiplier.setForeground(Color.white);
    add(clickMultiplier);
    // clicks per second indicator
    cpsIndicator = new JLabel(cps + " clicks per second");
    cpsIndicator.setBounds(570, 150, getWidth(), 50);
    cpsIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 10));
    cpsIndicator.setForeground(Color.white);
    add(cpsIndicator);

    // event indicator
    eventIndicator = new JLabel("Welcome to doge clicker!");
    eventIndicator.setBounds(700, 530, getWidth(), 50);
    eventIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 15));
    eventIndicator.setForeground(Color.white);
    add(eventIndicator);

    // states the num of doge and doge per second
    dogeCount = new JLabel("Doge: " + doge);
    dogeCount.setBounds(0, 0, getWidth(), 120);
    dogeCount.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
    dogeCount.setForeground(Color.white);
    dogeCount.setHorizontalAlignment(JLabel.CENTER);
    add(dogeCount);
    dogePerSecond = new JLabel("You get " + dps + " doge per second");
    dogePerSecond.setBounds(0, 25, getWidth(), 120);
    dogePerSecond.setFont(new Font("Comic Sans MS", Font.BOLD, 11));
    dogePerSecond.setForeground(Color.white);
    dogePerSecond.setHorizontalAlignment(JLabel.CENTER);
    add(dogePerSecond);
    dogeClicktext = new JLabel("Click for more doge");
    dogeClicktext.setBounds(400, 185, 200, 50);
    dogeClicktext.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClicktext.setForeground(Color.white);
    dogeClicktext.setHorizontalAlignment(JLabel.CENTER);
    add(dogeClicktext);
    // doge button testing button
    devButton = new JButton(new ImageIcon());
    devButton.addActionListener(this);
    devButton.setBounds(0, 0, 50, 50);
    devButton.setToolTipText("Such Secret");
    devButton.setOpaque(false);
    devButton.setContentAreaFilled(false);
    devButton.setBorderPainted(false);
    add(devButton);

    // options and save buttons
    options = new JButton(new ImageIcon("Images/option.png"));
    options.addActionListener(this);
    options.setBounds(900, 10, 70, 70);
    options.setOpaque(false);
    options.setBorder(BorderFactory.createLineBorder(Color.black));
    options.setToolTipText("Go to options");
    add(options);
    save = new JButton(new ImageIcon("Images/save.png"));
    save.addActionListener(this);
    save.setBounds(820, 10, 70, 70);
    save.setOpaque(false);
    save.setBorder(BorderFactory.createLineBorder(Color.black));
    save.setToolTipText("Save a file");
    add(save);
    open = new JButton(new ImageIcon("Images/open.png"));
    open.addActionListener(this);
    open.setBounds(740, 10, 70, 70);
    open.setOpaque(false);
    open.setBorder(BorderFactory.createLineBorder(Color.black));
    open.setToolTipText("Open a file");
    add(open);

    // news headline label that will move
    for (int i = 0; i < 3; i++) {

      newsHeadline[i] = new JLabel("Welcome to Doge clicker this is a news headline!");
      newsHeadline[i].setBounds(-200 - (475 * i), 615, getWidth(), 40);
      newsHeadline[i].setFont(new Font("Comic Sans MS", Font.BOLD, 13));
      newsHeadline[i].setForeground(Color.white);
      add(newsHeadline[i]);
    }

    // create all buttons and button stats and labels for producers
    for (int i = 0; i < MAX_UPGRADES; i++) {

      producerStats[i] = new Producers(i);
      producers[i] = new JButton(new ImageIcon(producerStats[i].getImage()));
      producers[i].addActionListener(this);
      producers[i].setOpaque(false);
      producers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      producers[i].setToolTipText(
          "Your "
              + producerStats[i].getButtonName()
              + " gives "
              + producerStats[i].getDogeProduction() * producerStats[i].getCount()
              + " doge per second");
      producers[i].setBounds(0, 0, 70, 70);

      buyProducers[i] =
          new JLabel(
              "Buy "
                  + producerStats[i].getButtonName()
                  + " for "
                  + producerStats[i].getCost()
                  + " doge");
      buyProducers[i].setBounds(0, 0, getWidth(), 100);
      buyProducers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyProducers[i].setForeground(Color.white);

      buyDetails[i] =
          new JLabel(
              "You have: " + producerStats[i].getCount() + " " + producerStats[i].getButtonName());
      buyDetails[i].setBounds(0, 0, getWidth(), 100);
      buyDetails[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyDetails[i].setForeground(Color.white);
    }
    // buttons and labels for click upgrades clickers
    for (int i = 0; i < MAX_CLICK; i++) {

      clickerStats[i] = new Clickers(i);
      clickers[i] = new JButton(new ImageIcon(clickerStats[i].getImage()));
      clickers[i].addActionListener(this);
      if (clickerStats[i].getClickMultiplier() == 1) {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get +"
                + clickerStats[i].getClickBonus()
                + " doge per click");
      } else {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get x"
                + clickerStats[i].getClickMultiplier()
                + " doge per click");
      }
      clickers[i].setOpaque(false);
      clickers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      clickers[i].setBounds(0, 0, 70, 70);

      buyClickers[i] =
          new JLabel(
              "Buy "
                  + clickerStats[i].getButtonName()
                  + " for "
                  + clickerStats[i].getCost()
                  + " doge");
      buyClickers[i].setBounds(0, 0, getWidth(), 100);
      buyClickers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyClickers[i].setForeground(Color.white);
    }

    // labels for achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {
      achievementStats[i] = new Achievements(i);
      achievements[i] = new JLabel(new ImageIcon(achievementStats[i].getImage()));
      achievements[i].setBorder(BorderFactory.createLineBorder(Color.black));
      achievements[i].setToolTipText("Achievement: " + achievementStats[i].getButtonName());
      achievements[i].setBounds(0, 0, 70, 70);
    }

    // JPanel containing achievements
    JPanel achievementPanel = new JPanel();
    achievementPanel.setPreferredSize(new Dimension(350, 70));
    achievementPanel.setLayout(null);
    achievementPanel.setOpaque(false);

    // JScrollpane containing JPanel for achievements
    JScrollPane achievementDisplay = new JScrollPane();
    achievementDisplay.setViewportBorder(new LineBorder(Color.black));
    achievementDisplay.setSize(280, 90);
    achievementDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    achievementDisplay.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    achievementDisplay.getVerticalScrollBar().setUnitIncrement(10);
    achievementDisplay.setLocation(50, 20);
    achievementDisplay.setOpaque(false);
    add(achievementDisplay);

    // adds the panel
    achievementDisplay.getViewport().add(achievementPanel);
    achievementDisplay.getViewport().setOpaque(false);

    // adds all achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {

      achievementPanel.add(achievements[i]);
      achievements[i].setLocation(0 + i * 70, 0);
      achievements[i].setVisible(false);
    }

    // jpanel containing upgrades for producers
    JPanel upgradePanel = new JPanel();
    upgradePanel.setPreferredSize(new Dimension(350, 770));
    upgradePanel.setLayout(null);
    upgradePanel.setOpaque(false);

    // Jscrollpane containing jpanel for producers
    JScrollPane producerUpgrades = new JScrollPane();
    producerUpgrades.setViewportBorder(new LineBorder(Color.black));
    producerUpgrades.setSize(350, 300);
    producerUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    producerUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    producerUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    producerUpgrades.setLocation(0, 200);
    producerUpgrades.setOpaque(false);
    add(producerUpgrades);

    producerUpgrades.getViewport().setOpaque(false);
    producerUpgrades.getViewport().add(upgradePanel);

    // adds all upgrades
    for (int i = 0; i < MAX_UPGRADES; i++) {

      upgradePanel.add(producers[i]);
      producers[i].setLocation(0, (i) * 70);
      upgradePanel.add(buyProducers[i]);
      buyProducers[i].setLocation(90, (i * 70) - 35);
      upgradePanel.add(buyDetails[i]);
      buyDetails[i].setLocation(90, (i * 70) - 20);
    }

    // jpanel containing upgrades for clickers
    JPanel clickPanel = new JPanel();
    clickPanel.setPreferredSize(new Dimension(350, 350));
    clickPanel.setLayout(null);
    clickPanel.setOpaque(false);

    // Jscrollpane containing jpanel for clickers
    JScrollPane clickUpgrades = new JScrollPane();
    clickUpgrades.setViewportBorder(new LineBorder(Color.black));
    clickUpgrades.setSize(350, 300);
    clickUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    clickUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    clickUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    clickUpgrades.setLocation(650, 200);
    clickUpgrades.setOpaque(false);
    add(clickUpgrades);
    clickUpgrades.getViewport().add(clickPanel);
    clickUpgrades.getViewport().setOpaque(false);

    // adds all click upgrades
    for (int i = 0; i < MAX_CLICK; i++) {

      clickPanel.add(clickers[i]);
      clickers[i].setLocation(0, (i) * 70);
      clickPanel.add(buyClickers[i]);
      buyClickers[i].setLocation(80, (i * 70) - 30);
    }

    // dancing snoop dog image
    JLabel snoop = new JLabel(new ImageIcon("Images//snoop.gif"));
    snoop.setBounds(450, 370, 150, 308);
    snoop.setOpaque(false);
    add(snoop);

    // background image
    JLabel background = new JLabel(new ImageIcon("Images//dogebackground.png"));
    background.setBounds(0, 0, 1000, 700);
    add(background);

    // makes everything above visible
    setVisible(true);
    // flavour click will remain invisible
    flavourClick.setVisible(false);

    // timer for news headline, runs every 20 milliseconds
    MyTimerTask task = new MyTimerTask();
    Timer newsTimer = new Timer();
    newsTimer.scheduleAtFixedRate(task, 0, 20);
  }
コード例 #26
0
ファイル: AnimationWidget.java プロジェクト: nbearson/IDV
  /**
   * Make the UI for this widget.
   *
   * @param floatToolBar true if the toolbar should be floatable
   * @return UI as a Component
   */
  private JComponent doMakeContents(boolean floatToolBar) {

    String imgp = "/auxdata/ui/icons/";
    KeyListener listener =
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if ((e.getSource() instanceof JComboBox)) {
              return;
            }
            int code = e.getKeyCode();
            char c = e.getKeyChar();
            if ((code == KeyEvent.VK_RIGHT) || (code == KeyEvent.VK_KP_RIGHT)) {
              if (e.isShiftDown()) {
                gotoIndex(anime.getNumSteps() - 1);
              } else {
                actionPerformed(CMD_FORWARD);
              }
            } else if ((code == KeyEvent.VK_LEFT) || (code == KeyEvent.VK_KP_LEFT)) {
              if (e.isShiftDown()) {
                gotoIndex(0);
              } else {
                actionPerformed(CMD_BACKWARD);
              }
            } else if (code == KeyEvent.VK_ENTER) {
              actionPerformed(CMD_STARTSTOP);
            } else if ((code == KeyEvent.VK_P) && e.isControlDown()) {
              actionPerformed(CMD_PROPS);
            } else if (Character.isDigit(c)) {
              int step = new Integer("" + c).intValue() - 1;
              if (step < 0) {
                step = 0;
              }
              if (step >= anime.getNumSteps()) {
                step = anime.getNumSteps() - 1;
              }
              gotoIndex(step);
            }
          }
        };

    List buttonList = new ArrayList();
    buttonList.add(timesCbx);
    // Update the list of times
    setTimesInTimesBox();

    Dimension preferredSize = timesCbx.getPreferredSize();
    if (preferredSize != null) {
      int height = preferredSize.height;
      if (height < 50) {
        JComponent filler = GuiUtils.filler(3, height);
        buttonList.add(filler);
      }
    }

    String[][] buttonInfo = {
      {"Go to first frame", CMD_BEGINNING, getIcon("Rewind")},
      {"One frame back", CMD_BACKWARD, getIcon("StepBack")},
      {"Run/Stop", CMD_STARTSTOP, getIcon("Play")},
      {"One frame forward", CMD_FORWARD, getIcon("StepForward")},
      {"Go to last frame", CMD_END, getIcon("FastForward")},
      {"Properties", CMD_PROPS, getIcon("Information")}
    };

    for (int i = 0; i < buttonInfo.length; i++) {
      JButton btn = GuiUtils.getScaledImageButton(buttonInfo[i][2], getClass(), 2, 2);
      btn.setToolTipText(buttonInfo[i][0]);
      btn.setActionCommand(buttonInfo[i][1]);
      btn.addActionListener(this);
      btn.addKeyListener(listener);
      //            JComponent wrapper = GuiUtils.center(btn);
      //            wrapper.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
      btn.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
      buttonList.add(btn);
      //            buttonList.add(wrapper);
      if (i == 2) {
        startStopBtn = btn;
      }
    }

    JComponent contents = GuiUtils.hflow(buttonList, 1, 0);
    if (boxPanel == null) {
      boxPanel = new AnimationBoxPanel(this);
      if (timesArray != null) {
        updateBoxPanel(timesArray);
      }
    }
    boxPanel.addKeyListener(listener);
    if (!getBoxPanelVisible()) {
      boxPanel.setVisible(false);
    }
    contents =
        GuiUtils.doLayout(new Component[] {boxPanel, contents}, 1, GuiUtils.WT_Y, GuiUtils.WT_N);
    //      GuiUtils.addKeyListenerRecurse(listener,contents);
    if (floatToolBar) {
      JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL);
      toolbar.setFloatable(true);
      contents = GuiUtils.left(contents);
      toolbar.add(contents);
      contents = toolbar;
    }

    updateRunButton();
    madeContents = true;
    return contents;
  }
コード例 #27
0
  /** This method is called from within the constructor to initialize the form. */
  public void initComponents() {
    /** *************** The main frame ************************************** */
    // width, height
    this.setSize(560, 370);
    Container container = this.getContentPane();
    container.setLayout(new BoxLayout(getContentPane(), 1));
    container.setBackground(containerBackGroundColor);
    this.setLocation(0, 0);
    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            new AlertInstantMessaging(
                "Your changes will not be checked: use the Submit button!!!",
                JOptionPane.WARNING_MESSAGE);
            hideFrame();
          }
        });

    /** **************** The components ********************************* */
    firstPanel = new JPanel();
    firstPanel.setBorder(BorderFactory.createEmptyBorder(15, 4, 15, 4));
    // If put to False: we see the container's background
    firstPanel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    firstPanel.setLayout(new GridLayout(11, 2, 2, 2));
    container.add(firstPanel);

    outboundProxyAddressLabel = new JLabel("Outbound proxy IP address:");
    outboundProxyAddressLabel.setForeground(Color.black);
    outboundProxyAddressTextField = new JTextField(20);
    outboundProxyAddressLabel.setBorder(labelBorder);
    outboundProxyAddressLabel.setOpaque(true);
    outboundProxyAddressLabel.setBackground(labelBackGroundColor);
    firstPanel.add(outboundProxyAddressLabel);
    firstPanel.add(outboundProxyAddressTextField);

    outboundProxyPortLabel = new JLabel("Outbound proxy port:");
    outboundProxyPortLabel.setForeground(Color.black);
    outboundProxyPortTextField = new JTextField(20);
    outboundProxyPortLabel.setBorder(labelBorder);
    outboundProxyPortLabel.setOpaque(true);
    outboundProxyPortLabel.setBackground(labelBackGroundColor);
    firstPanel.add(outboundProxyPortLabel);
    firstPanel.add(outboundProxyPortTextField);

    registrarAddressLabel = new JLabel("Registrar IP address:");
    registrarAddressLabel.setForeground(Color.black);
    registrarAddressTextField = new JTextField(20);
    registrarAddressLabel.setBorder(labelBorder);
    registrarAddressLabel.setOpaque(true);
    registrarAddressLabel.setBackground(labelBackGroundColor);
    firstPanel.add(registrarAddressLabel);
    firstPanel.add(registrarAddressTextField);

    registrarPortLabel = new JLabel("Registrar port:");
    registrarPortLabel.setForeground(Color.black);
    registrarPortTextField = new JTextField(20);
    registrarPortLabel.setBorder(labelBorder);
    registrarPortLabel.setOpaque(true);
    registrarPortLabel.setBackground(labelBackGroundColor);
    firstPanel.add(registrarPortLabel);
    firstPanel.add(registrarPortTextField);

    imAddressLabel = new JLabel("Contact IP address:");
    imAddressLabel.setForeground(Color.black);
    imAddressTextField = new JTextField(20);
    imAddressLabel.setBorder(labelBorder);
    imAddressLabel.setOpaque(true);
    imAddressLabel.setBackground(labelBackGroundColor);
    firstPanel.add(imAddressLabel);
    firstPanel.add(imAddressTextField);

    imPortLabel = new JLabel("Contact port:");
    imPortLabel.setForeground(Color.black);
    imPortTextField = new JTextField(20);
    imPortLabel.setBorder(labelBorder);
    imPortLabel.setOpaque(true);
    imPortLabel.setBackground(labelBackGroundColor);
    firstPanel.add(imPortLabel);
    firstPanel.add(imPortTextField);

    imProtocolLabel = new JLabel("Contact transport:");
    imProtocolLabel.setForeground(Color.black);
    imProtocolTextField = new JTextField(20);
    imProtocolLabel.setBorder(labelBorder);
    imProtocolLabel.setOpaque(true);
    imProtocolLabel.setBackground(labelBackGroundColor);
    firstPanel.add(imProtocolLabel);
    firstPanel.add(imProtocolTextField);

    outputFileLabel = new JLabel("Output file:");
    outputFileLabel.setForeground(Color.black);
    outputFileTextField = new JTextField(20);
    outputFileLabel.setBorder(labelBorder);
    outputFileLabel.setOpaque(true);
    outputFileLabel.setBackground(labelBackGroundColor);
    firstPanel.add(outputFileLabel);
    firstPanel.add(outputFileTextField);

    buddiesFileLabel = new JLabel("Buddies file:");
    buddiesFileLabel.setForeground(Color.black);
    buddiesFileTextField = new JTextField(20);
    buddiesFileLabel.setBorder(labelBorder);
    buddiesFileLabel.setOpaque(true);
    buddiesFileLabel.setBackground(labelBackGroundColor);
    firstPanel.add(buddiesFileLabel);
    firstPanel.add(buddiesFileTextField);

    authenticationFileLabel = new JLabel("Authentication file:");
    authenticationFileLabel.setForeground(Color.black);
    authenticationFileTextField = new JTextField(20);
    authenticationFileLabel.setBorder(labelBorder);
    authenticationFileLabel.setOpaque(true);
    authenticationFileLabel.setBackground(labelBackGroundColor);
    firstPanel.add(authenticationFileLabel);
    firstPanel.add(authenticationFileTextField);

    defaultRouterLabel = new JLabel("Default router class name:");
    defaultRouterLabel.setForeground(Color.black);
    defaultRouterTextField = new JTextField(20);
    defaultRouterLabel.setBorder(labelBorder);
    defaultRouterLabel.setOpaque(true);
    defaultRouterLabel.setBackground(labelBackGroundColor);
    firstPanel.add(defaultRouterLabel);
    firstPanel.add(defaultRouterTextField);

    thirdPanel = new JPanel();
    thirdPanel.setOpaque(false);
    // top, left, bottom, right
    thirdPanel.setLayout(new FlowLayout(FlowLayout.CENTER));

    submitButton = new JButton(" Submit ");
    submitButton.setToolTipText("Submit your changes!");
    submitButton.setFocusPainted(false);
    submitButton.setFont(new Font("Dialog", 1, 16));
    submitButton.setBackground(buttonBackGroundColor);
    submitButton.setBorder(buttonBorder);
    submitButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            submitButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(submitButton);
    container.add(thirdPanel);
  }
コード例 #28
0
  public JMovieControlAqua() {
    // Set the background color to the border color of the buttons.
    // This way the toolbar won't look too ugly when the buttons
    // are displayed before they have been loaded completely.
    // setBackground(new Color(118, 118, 118));
    setBackground(Color.WHITE);

    Dimension buttonSize = new Dimension(16, 16);
    GridBagLayout gridbag = new GridBagLayout();
    Insets margin = new Insets(0, 0, 0, 0);
    setLayout(gridbag);
    GridBagConstraints c;

    ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels");
    colorCyclingButton = new JToggleButton();
    colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText"));
    colorCyclingButton.addActionListener(this);
    colorCyclingButton.setPreferredSize(buttonSize);
    colorCyclingButton.setMinimumSize(buttonSize);
    colorCyclingButton.setVisible(false);
    colorCyclingButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(colorCyclingButton, c);
    add(colorCyclingButton);

    audioButton = new JToggleButton();
    audioButton.setToolTipText(labels.getString("audio.toolTipText"));
    audioButton.addActionListener(this);
    audioButton.setPreferredSize(buttonSize);
    audioButton.setMinimumSize(buttonSize);
    audioButton.setVisible(false);
    audioButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(audioButton, c);
    add(audioButton);

    startButton = new JToggleButton();
    startButton.setToolTipText(labels.getString("play.toolTipText"));
    startButton.addActionListener(this);
    startButton.setPreferredSize(buttonSize);
    startButton.setMinimumSize(buttonSize);
    startButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 1;
    // c.gridy = 0;
    gridbag.setConstraints(startButton, c);
    add(startButton);

    slider = new JMovieSliderAqua();
    c = new GridBagConstraints();
    // c.gridx = 2;
    // c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(slider, c);
    add(slider);

    rewindButton = new JButton();
    rewindButton.setToolTipText(labels.getString("previous.toolTipText"));
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 3;
    // c.gridy = 0;

    gridbag.setConstraints(rewindButton, c);
    add(rewindButton);
    rewindButton.addActionListener(this);

    forwardButton = new JButton();
    forwardButton.setToolTipText(labels.getString("next.toolTipText"));
    buttonSize = new Dimension(17, 16);
    forwardButton.setPreferredSize(buttonSize);
    forwardButton.setMinimumSize(buttonSize);
    forwardButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 4;
    // c.gridy = 0;
    gridbag.setConstraints(forwardButton, c);
    add(forwardButton);
    forwardButton.addActionListener(this);

    // The spacer is used when the play controls are hidden
    spacer = new JPanel(new BorderLayout());
    spacer.setVisible(false);
    spacer.setPreferredSize(new Dimension(16, 16));
    spacer.setMinimumSize(new Dimension(16, 16));
    spacer.setOpaque(false);
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(spacer, c);
    add(spacer);

    Border border =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.border.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderP.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4))));

    Border westBorder =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWest.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWestP.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4))));

    startButton.setBorder(westBorder);
    colorCyclingButton.setBorder(westBorder);
    audioButton.setBorder(westBorder);
    rewindButton.setBorder(westBorder);
    forwardButton.setBorder(border);
    startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton));
    colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton));
    forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton));

    colorCyclingButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setDisabledIcon(
        new ImageIcon(
            Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png")));
    audioButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png")));
    audioButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png")));
    audioButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png")));
    startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png")));
    startButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png")));
    startButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png")));
    rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png")));
    rewindButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png")));
    forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png")));
    forwardButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png")));

    // Automatic scrolling
    scrollHandler = new ScrollHandler();
    scrollTimer = new Timer(60, scrollHandler);
    scrollTimer.setInitialDelay(300); // default InitialDelay?
    forwardButton.addMouseListener(scrollHandler);
    rewindButton.addMouseListener(scrollHandler);
  }
コード例 #29
0
 private void setLookLowered(JButton button) {
   button.setBorder(LOWERED_BORDER);
   button.setHorizontalAlignment(SwingConstants.RIGHT);
   button.setVerticalAlignment(SwingConstants.BOTTOM);
   button.setBorderPainted(true);
 }
コード例 #30
0
  private JComponent buildTopPanel(boolean enablePipette) throws ParseException {
    final JPanel result = new JPanel(new BorderLayout());

    final JPanel previewPanel = new JPanel(new BorderLayout());
    if (enablePipette && myPicker != null) {
      final JButton pipette = new JButton();
      pipette.setUI(new BasicButtonUI());
      pipette.setRolloverEnabled(true);
      pipette.setIcon(AllIcons.Ide.Pipette);
      pipette.setBorder(IdeBorderFactory.createEmptyBorder());
      pipette.setRolloverIcon(AllIcons.Ide.Pipette_rollover);
      pipette.setFocusable(false);
      pipette.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              myPicker.setInitialColor(getColor());
              myPicker.show();
            }
          });
      previewPanel.add(pipette, BorderLayout.WEST);
    }

    myPreviewComponent = new ColorPreviewComponent();
    previewPanel.add(myPreviewComponent, BorderLayout.CENTER);

    result.add(previewPanel, BorderLayout.NORTH);

    final JPanel rgbPanel = new JPanel();
    rgbPanel.setLayout(new BoxLayout(rgbPanel, BoxLayout.X_AXIS));
    if (!UIUtil.isUnderAquaLookAndFeel()) {
      myR_after.setPreferredSize(new Dimension(14, -1));
      myG_after.setPreferredSize(new Dimension(14, -1));
      myB_after.setPreferredSize(new Dimension(14, -1));
    }
    rgbPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    rgbPanel.add(myR);
    rgbPanel.add(myRed);
    if (!UIUtil.isUnderAquaLookAndFeel()) rgbPanel.add(myR_after);
    rgbPanel.add(Box.createHorizontalStrut(2));
    rgbPanel.add(myG);
    rgbPanel.add(myGreen);
    if (!UIUtil.isUnderAquaLookAndFeel()) rgbPanel.add(myG_after);
    rgbPanel.add(Box.createHorizontalStrut(2));
    rgbPanel.add(myB);
    rgbPanel.add(myBlue);
    if (!UIUtil.isUnderAquaLookAndFeel()) rgbPanel.add(myB_after);
    rgbPanel.add(Box.createHorizontalStrut(2));
    rgbPanel.add(myFormat);

    result.add(rgbPanel, BorderLayout.WEST);

    final JPanel hexPanel = new JPanel();
    hexPanel.setLayout(new BoxLayout(hexPanel, BoxLayout.X_AXIS));
    hexPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    hexPanel.add(new JLabel("#"));
    hexPanel.add(myHex);

    result.add(hexPanel, BorderLayout.EAST);

    return result;
  }