public void actionPerformed(ActionEvent ev) {
    if (collapsed) {
      if (label != null) {
        remove(label);
      }
      add(comp);
      moreOrLessButton.setIcon(collapseIcon);
    } else {
      remove(comp);
      if (valueLabelStr != null) {
        if (label == null) {
          label = new JLabel(Resources.format(Messages.CURRENT_VALUE, valueLabelStr));
        }
        add(label);
      }
      moreOrLessButton.setIcon(expandIcon);
    }
    collapsed = !collapsed;

    JComponent container = (JComponent) getParent();
    if (container != null && container.getLayout() instanceof VariableGridLayout) {

      ((VariableGridLayout) container.getLayout()).setFillRow(this, !collapsed);
      container.revalidate();
    }
  }
Beispiel #2
0
  protected void initBtn() {
    bOk.setText("确定");
    bOk.setToolTipText("确定");
    bOk.setMargin(new Insets(0, 0, 0, 0));
    bOk.setIcon(ExplorerIcons.getExplorerIcon("jprofiler/checkbox_16.png"));
    bOk.addActionListener(this);

    bExit.setText("取消");
    bExit.setToolTipText("取消");
    bExit.setMargin(new Insets(0, 0, 0, 0));
    bExit.setIcon(ExplorerIcons.getExplorerIcon("jprofiler/delete.png"));
    bExit.addActionListener(this);
  }
Beispiel #3
0
 public void evaluate() {
   try {
     // clear problems and console messages
     problemsView.setText("");
     consoleView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     tabbedPane.setSelectedIndex(0);
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Running ...");
     tabbedPane.setSelectedIndex(1);
     // update run button
     runButton.setIcon(stopImage);
     runButton.setActionCommand("Stop");
     // start run thread
     runThread = new RunThread(root);
     runThread.start();
   } catch (SyntaxError e) {
     tabbedPane.setSelectedIndex(0);
     System.err.println(
         "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage());
   } catch (Error e) {
     // parsing error
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
    public void createColorPanel() {
      JPanel colorPanel = new JPanel(new GridLayout(0, 1));
      int curRow = 0;
      for (int i = 0; i < colorString.length / 5; i++) {
        JPanel row = new JPanel(new GridLayout(1, 0, 2, 1));
        row.setBorder(new EmptyBorder(2, 2, 2, 2));

        for (int j = curRow; j < curRow + 5; j++) {
          final JLabel colorLabel =
              new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER);
          colorLabel.setOpaque(true);
          final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1);
          final Border lnb = BorderFactory.createLineBorder(Color.black);
          final Border cmb = BorderFactory.createCompoundBorder(lnb, emb);
          colorLabel.setBorder(emb);
          colorLabel.addMouseListener(
              new MouseAdapter() {

                public void mouseClicked(MouseEvent e) {
                  JButton btn = (JButton) getTarget();
                  Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor();
                  btn.setIcon(new ColoredIcon(selColor));
                  setVisible(false);
                  btn.doClick();
                  oldLabel.setBackground(null);
                  colorLabel.setBackground(new Color(150, 150, 200));
                  colorLabel.setBorder(emb);
                  oldLabel = colorLabel;
                }

                public void mouseEntered(MouseEvent e) {
                  colorLabel.setBorder(cmb);
                  colorLabel.setBackground(new Color(150, 150, 200));
                }

                public void mouseExited(MouseEvent e) {
                  colorLabel.setBorder(emb);
                  colorLabel.setBackground(null);
                }
              });
          row.add(colorLabel);
        }
        colorPanel.add(row);
        curRow += row.getComponentCount();
        // System.out.println(curRow);
      }

      add(colorPanel, BorderLayout.CENTER);

      // More Colors Button
      moreColors = new JButton(new ColorChooserAction((JButton) target));
      moreColors.setText("More Colors...");
      moreColors.setIcon(null);
      moreColors.setFont(new Font("Verdana", Font.PLAIN, 10));
      //
      JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER));
      c.add(moreColors);
      add(c, BorderLayout.SOUTH);
    }
 public void actionPerformed(ActionEvent e) {
   if (cChooser == null) {
     cChooser = new JColorChooser();
   }
   Color color =
       cChooser.showDialog(
           target, "Available Colors", ((ColoredIcon) target.getIcon()).getCurrentColor());
   target.setIcon(new ColoredIcon(color));
   target.doClick();
 }
Beispiel #6
0
 public void runFinished() {
   // program execution finished so update
   // status and run button accordingly
   if (runThread == null) {
     // _runThread = null only if
     // execution stopped by user via
     // run button
     statusView.setText(" Stopped.");
   } else {
     statusView.setText(" Done.");
   }
   runButton.setActionCommand("Run");
   runButton.setIcon(runImage);
 }
Beispiel #7
0
  public final void initializeGui() {
    // set up the main GUI
    gui.setBorder(new EmptyBorder(5, 5, 5, 5));
    JToolBar tools = new JToolBar();
    tools.setFloatable(false);
    gui.add(tools, BorderLayout.PAGE_START);
    tools.add(new JButton("New")); // TODO - add functionality!
    tools.addSeparator();
    tools.add(new JLabel("Player:")); // TODO - add functionality!
    tools.addSeparator();
    tools.add(message);

    playBoard = new JPanel(new GridLayout(0, 11));
    playBoard.setBorder(new LineBorder(Color.BLACK));
    gui.add(playBoard);

    // create the chess board squares
    Insets buttonMargin = new Insets(0, 0, 0, 0);
    for (int ii = 0; ii < playBoardSquares.length; ii++) {
      for (int jj = 0; jj < playBoardSquares[ii].length; jj++) {
        JButton b = new JButton();
        b.setMargin(buttonMargin);
        // our chess pieces are 64x64 px in size, so we'll
        // 'fill this in' using a transparent icon..
        ImageIcon icon = new ImageIcon(new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB));
        b.setIcon(icon);
        b.setBackground(Color.BLUE);
        playBoardSquares[jj][ii] = b;
      }
    }

    // fill the chess board
    playBoard.add(new JLabel(""));
    // fill the top row
    for (int ii = 0; ii < 10; ii++) {
      playBoard.add(new JLabel(COLS.substring(ii, ii + 1), SwingConstants.CENTER));
    }
    // fill the black non-pawn piece row
    for (int ii = 0; ii < 10; ii++) {
      for (int jj = 0; jj < 10; jj++) {
        switch (jj) {
          case 0:
            playBoard.add(new JLabel("" + (ii + 1), SwingConstants.CENTER));
          default:
            playBoard.add(playBoardSquares[jj][ii]);
        }
      }
    }
  }
  private void jbInit() throws Exception {
    titledBorder1 = new TitledBorder("");
    this.setLayout(baseLayout);

    double[][] lower_size = {
      {TableLayout.PREFERRED, TableLayout.FILL, 25}, {25, 25, TableLayout.FILL}
    };
    mLowerPanelLayout = new TableLayout(lower_size);

    mLowerPanel.setLayout(mLowerPanelLayout);

    double[][] dir_size = {
      {TableLayout.FILL, TableLayout.PREFERRED}, {TableLayout.PREFERRED, TableLayout.FILL}
    };
    mDirectionsPanelLayout = new TableLayout(dir_size);
    mDirectionsPanel.setLayout(mDirectionsPanelLayout);

    // Try to get icons for the toolbar buttons
    try {
      ClassLoader loader = getClass().getClassLoader();
      mAddIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/add.gif"));
      mRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove.gif"));
      mDisabledRemoveIcon =
          new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove_disabled.gif"));

      mAddNodeBtn.setIcon(mAddIcon);
      mRemoveNodeBtn.setIcon(mRemoveIcon);
      mRemoveNodeBtn.setDisabledIcon(mDisabledRemoveIcon);
    } catch (Exception e) {
      // Ack! No icons. Use text labels instead
      mAddNodeBtn.setText("Add");
      mRemoveNodeBtn.setText("Remove");
    }

    /*
    mAddNodeBtn.setMaximumSize(new Dimension(130, 33));
    mAddNodeBtn.setMinimumSize(new Dimension(130, 33));
    mAddNodeBtn.setPreferredSize(new Dimension(130, 33));
    mAddNodeBtn.setText("Add Node");
    */
    mAddNodeBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mAddNodeBtn_actionPerformed(e);
          }
        });
    /*
    mRemoveNodeBtn.setMaximumSize(new Dimension(130, 33));
    mRemoveNodeBtn.setMinimumSize(new Dimension(130, 33));
    mRemoveNodeBtn.setPreferredSize(new Dimension(130, 33));
    mRemoveNodeBtn.setText("Remove Node");
    */
    mRemoveNodeBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mRemoveNode();
          }
        });
    mHostnameLabel.setHorizontalAlignment(SwingConstants.TRAILING);
    mHostnameLabel.setLabelFor(mHostnameField);
    mHostnameLabel.setText("Hostname:");

    mHostnameField.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mAddNodeBtn_actionPerformed(e);
          }
        });
    mDirectionsPanel.setBorder(BorderFactory.createEtchedBorder());
    mTitleLabel.setFont(new java.awt.Font("Serif", 1, 20));
    mTitleLabel.setHorizontalAlignment(SwingConstants.CENTER);
    mTitleLabel.setText("Add Cluster Nodes");
    mDirectionsLabel.setText("Click on the add button to add nodes to your cluster configuration.");
    mDirectionsLabel.setLineWrap(true);
    mDirectionsLabel.setEditable(false);
    mDirectionsLabel.setBackground(mTitleLabel.getBackground());

    baseLayout.setHgap(5);
    baseLayout.setVgap(5);
    mLowerPanel.add(
        mHostnameLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mHostnameField, new TableLayoutConstraints(1, 0, 1, 0, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mListScrollPane1,
        new TableLayoutConstraints(0, 1, 1, 2, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mAddNodeBtn, new TableLayoutConstraints(2, 0, 2, 0, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mRemoveNodeBtn, new TableLayoutConstraints(2, 1, 2, 1, TableLayout.FULL, TableLayout.FULL));
    this.add(mLowerPanel, BorderLayout.CENTER);
    mListScrollPane1.getViewport().add(lstNodes, null);
    mDirectionsPanel.add(
        mTitleLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL));
    mDirectionsPanel.add(
        mDirectionsLabel,
        new TableLayoutConstraints(0, 1, 0, 1, TableLayout.FULL, TableLayout.FULL));
    mDirectionsPanel.add(
        mIconLabel, new TableLayoutConstraints(1, 0, 1, 1, TableLayout.FULL, TableLayout.FULL));
    this.add(mDirectionsPanel, BorderLayout.NORTH);
  }
  public Principal() {
    setResizable(false);
    setForeground(UIManager.getColor("CheckBoxMenuItem.selectionBackground"));
    setFont(new Font("Andalus", 1, 12));
    setTitle("CEREAIS PEGER LTDA - EMISSOR DE RECIBO");
    setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage("img\\Super Collection\\Applications\\Script Editor.png"));
    setDefaultCloseOperation(0);
    setBounds(100, 100, 566, 497);
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));
    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setBorder(
        new CompoundBorder(
            new LineBorder(new Color(0, 0, 0), 3), new BevelBorder(1, null, null, null, null)));
    contentPane.add(layeredPane, "Center");
    JButton btEmiteRecibo = new JButton("Emitir Recibo");
    btEmiteRecibo.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            new Recibo().setVisible(true);
          }
        });
    btEmiteRecibo.setIcon(new ImageIcon("img\\PNG-48\\Modify.png"));
    btEmiteRecibo.setFont(new Font("Tahoma", 1, 12));
    btEmiteRecibo.setBackground(UIManager.getColor("Button.focus"));
    btEmiteRecibo.setBounds(74, 212, 181, 56);
    layeredPane.add(btEmiteRecibo);
    JButton btRelatorio = new JButton("Relatórios");
    btRelatorio.setIcon(new ImageIcon("img\\PNG-48\\Load.png"));
    btRelatorio.setFont(new Font("Tahoma", 1, 12));
    btRelatorio.setBackground(SystemColor.inactiveCaptionBorder);
    btRelatorio.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new Relatorios().setVisible(true);
          }
        });
    btRelatorio.setBounds(74, 279, 181, 56);
    layeredPane.add(btRelatorio);
    JButton btInfo = new JButton("Informações");
    btInfo.setIcon(new ImageIcon("img\\PNG-48\\Info.png"));
    btInfo.setFont(new Font("Tahoma", 1, 12));
    btInfo.setBackground(SystemColor.inactiveCaptionBorder);
    btInfo.setBounds(304, 279, 181, 56);
    layeredPane.add(btInfo);
    btInfo.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            (new Informacoes()).setVisible(true);
          }
        });
    JButton btSair = new JButton("Sair");
    btSair.setIcon(new ImageIcon("img\\PNG-32\\Exit.png"));
    btSair.setFont(new Font("Tahoma", 1, 13));
    btSair.setBackground(SystemColor.controlShadow);
    btSair.setBounds(379, 368, 106, 41);
    layeredPane.add(btSair);
    btSair.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            if (JOptionPane.showConfirmDialog(
                    null, "Deseja Encerrar o programa?", "ATENÇÃO !!! ", 0)
                == 0) System.exit(EXIT_ON_CLOSE);
          }
        });
    JButton btfornecedores = new JButton("Fornecedores");
    btfornecedores.setIcon(new ImageIcon("img\\PNG-48\\Profile.png"));
    btfornecedores.setFont(new Font("Tahoma", 1, 12));
    btfornecedores.setBackground(SystemColor.inactiveCaptionBorder);
    btfornecedores.setBounds(304, 212, 181, 56);
    layeredPane.add(btfornecedores);
    btfornecedores.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            new CrudFornecedores().setVisible(true);
          }
        });
    JPanel panelRecibo = new JPanel();
    panelRecibo.setForeground(UIManager.getColor("Button.disabledShadow"));
    panelRecibo.setBackground(UIManager.getColor("CheckBoxMenuItem.foreground"));
    panelRecibo.setBorder(UIManager.getBorder("DesktopIcon.border"));
    panelRecibo.setBounds(10, 11, 530, 77);
    layeredPane.add(panelRecibo);
    JLabel LabelRecibo = new JLabel("Emissor de Recibo Eletrônico");
    LabelRecibo.setForeground(UIManager.getColor("Button.background"));
    LabelRecibo.setHorizontalAlignment(2);
    LabelRecibo.setIcon(new ImageIcon("img\\PNG-48\\Modify.png"));
    LabelRecibo.setFont(new Font("Tahoma", 3, 18));
    panelRecibo.add(LabelRecibo);
    JPanel panel = new JPanel();
    panel.setBackground(UIManager.getColor("CheckBox.foreground"));
    panel.setBounds(45, 420, 457, 26);
    layeredPane.add(panel);
    JLabel lblAnthonyTailerCopy = new JLabel(" Anthony Tailer Copyright © ");
    lblAnthonyTailerCopy.setForeground(UIManager.getColor("Button.background"));
    panel.add(lblAnthonyTailerCopy);
    JLabel lblNewLabel = new JLabel("");
    lblNewLabel.setIcon(new ImageIcon("img\\LOGO PEGER 2.png"));
    lblNewLabel.setBounds(165, 99, 234, 88);
    layeredPane.add(lblNewLabel);
  }
 public void setSelectedColor(Color color) {
   selectedColor = new ColoredIcon(color);
   back.setIcon(selectedColor);
 }