/**
  * Reset the image rollover icon as enabled/disabled.
  *
  * @param enabled, the status to draw the image rollover icon for.
  */
 public void updateImageRollover(boolean enabled) {
   if (enabled) {
     pbImageRollover.setIcon(UIImages.get(IMAGE_ROLLOVER_ICON));
   } else {
     pbImageRollover.setIcon(UIImages.get(IMAGE_ROLLOVEROFF_ICON));
   }
 }
  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();
    }
  }
示例#3
0
  /** Reloads button resources. */
  public void loadSkin() {
    addButton.setIcon(
        GuiActivator.getResources().getImage("service.gui.icons.ADD_CONTACT_16x16_ICON"));
    callButton.setIcon(GuiActivator.getResources().getImage("service.gui.icons.CALL_16x16_ICON"));

    if (smsButton != null)
      smsButton.setIcon(GuiActivator.getResources().getImage("service.gui.icons.SMS_BUTTON_ICON"));
  }
示例#4
0
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(null);
   Bienvenue.setFont(new java.awt.Font("Garamond", 1, 24));
   Bienvenue.setForeground(SystemColor.textHighlight);
   Bienvenue.setRequestFocusEnabled(true);
   Bienvenue.setVerifyInputWhenFocusTarget(true);
   Bienvenue.setText("Bienvenue dans JChat");
   Bienvenue.setBounds(new Rectangle(125, 28, 305, 44));
   Pseudo_L.setFont(new java.awt.Font("Dialog", 1, 14));
   Pseudo_L.setText("Pseudonyme :");
   Pseudo_L.setBounds(new Rectangle(75, 94, 128, 28));
   nom.setText("");
   nom.setBounds(new Rectangle(229, 95, 108, 24));
   pwd.setText("");
   pwd.setBounds(new Rectangle(230, 135, 108, 25));
   pwd_L.setFont(new java.awt.Font("Dialog", 1, 14));
   pwd_L.setText("Mot de passe :");
   pwd_L.setBounds(new Rectangle(76, 133, 122, 31));
   gestionnaire_B gestionnaire = new gestionnaire_B();
   Connect.addActionListener(gestionnaire);
   Connect.setBackground(new Color(239, 240, 234));
   Connect.setBounds(new Rectangle(281, 251, 142, 30));
   Connect.setText("Connexion");
   Connect.setIcon(new ImageIcon(image_c));
   Annuler.addActionListener(gestionnaire);
   Annuler.setBackground(new Color(239, 240, 234));
   Annuler.setBounds(new Rectangle(104, 252, 140, 29));
   Annuler.setText("Annuler");
   Annuler.setIcon(new ImageIcon(image_d));
   this.getContentPane().setBackground(new Color(239, 240, 234));
   this.setForeground(new Color(239, 240, 234));
   this.setTitle("Interface de connexion des clients au serveur de chat");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
   jLabel1.setText("Adresse du serveur :");
   jLabel1.setBounds(new Rectangle(75, 176, 156, 26));
   jTextField1.setBounds(new Rectangle(230, 176, 108, 25));
   Icon siegle = new ImageIcon(image);
   siegle_L = new JLabel("", siegle, SwingConstants.LEFT);
   siegle_L.setBounds(new Rectangle(0, 1, 76, 105));
   this.getContentPane().add(jLabel1, null);
   this.getContentPane().add(pwd_L, null);
   this.getContentPane().add(Pseudo_L, null);
   this.getContentPane().add(jTextField1, null);
   this.getContentPane().add(nom, null);
   this.getContentPane().add(pwd, null);
   this.getContentPane().add(Bienvenue, null);
   this.getContentPane().add(Connect, null);
   this.getContentPane().add(Annuler, null);
   this.getContentPane().add(siegle_L, null);
   this.setSize(new Dimension(439, 321));
   this.setResizable(false);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   this.setVisible(true);
 }
示例#5
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);
  }
示例#6
0
  public void run() {
    for (int j = 0; j < 20; j++) butI[j].removeActionListener(this);

    Wait.manySec(10);
    if (but.getIcon() == butn.getIcon()) {
      but.setVisible(false);
      butn.setVisible(false);
    } else {
      but.setIcon(iconOrg);
      butn.setIcon(iconOrg);
    }

    isVisibl();
    for (int j = 0; j < 20; j++) butI[j].addActionListener(this);
  }
示例#7
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));
  }
示例#8
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.");
   }
 }
示例#9
0
  /**
   * Installs a Tool in the Toolbar
   *
   * @param toolbar as JToolbar
   * @param tool, Tool to install
   */
  public void installToolInToolBar(JToolBar toolbar, final Tool tool) {
    final JButton button;
    button = new JButton();

    button.setMargin(new Insets(0, 0, 0, 0));

    if (tool.getItemType() != null) {
      button.setIcon(tool.getItemType().getIcon());
      button.setToolTipText(tool.getItemType().getDescription());

    } else {
      button.setText("Tool"); // For Debugging
    }
    toolbar.add(button);
    toolButtons.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.setTool(tool, button);
          }
        });
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(true);
          }

          public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(false);
          }
        });
  }
示例#10
0
  private void buildPanel() {
    messageLabel = new JLabel("Enter a distance in Kilometers");

    kiloTextField = new JTextField(10);

    setColorCyan = new JButton("Cyanize");
    setColorGreen = new JButton("makeGreen");

    calcButton = new JButton("Calcumalate");

    ImageIcon image1 = new ImageIcon("10d.jpg");
    image = new JLabel(image1);
    calcButton.setForeground(Color.BLUE);

    calcButton.addActionListener(new calcButtonListener());
    setColorCyanListener listener = new setColorCyanListener();
    setColorCyan.addActionListener(listener);

    setColorGreenListener listenerG = new setColorGreenListener();
    setColorGreen.addActionListener(listenerG);
    calcButton.setIcon(image1);
    panel = new JPanel();

    panel.setLayout(new GridLayout(3, 3));
    panel.setBackground(Color.RED);
    panel.add(messageLabel);
    panel.add(kiloTextField);
    panel.add(calcButton);
    panel.add(setColorCyan);
    panel.add(setColorGreen);
    panel.add(image);
  }
示例#11
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));
  }
    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);
    }
示例#13
0
 private void configure(Object value) {
   this.separator = (SeparatorList.Separator<Issue>) value;
   Issue issue = separator.first();
   if (issue == null) return; // handle 'late' rendering calls after this separator is invalid
   expandButton.setIcon(separator.getLimit() == 0 ? EXPANDED_ICON : COLLAPSED_ICON);
   nameLabel.setText(
       nameFormat.format(new Object[] {issue.getSubcomponent(), new Integer(separator.size())}));
 }
示例#14
0
 public void setIcon(String command, ImageIcon icon) {
   JButton b = (JButton) buttons.get(command);
   if (b != null) {
     b.setIcon(icon);
     b.revalidate();
     setButtonsSize();
   }
 }
 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();
 }
示例#16
0
 public void actionPerformed(ActionEvent e) {
   final Lock writeLock = separatorList.getReadWriteLock().writeLock();
   writeLock.lock();
   boolean collapsed;
   try {
     collapsed = separator.getLimit() == 0;
     separator.setLimit(collapsed ? Integer.MAX_VALUE : 0);
   } finally {
     writeLock.unlock();
   }
   expandButton.setIcon(collapsed ? COLLAPSED_ICON : EXPANDED_ICON);
 }
示例#17
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);
 }
    JButton createButton() {
      JButton button;

      if (minimumWidth > 0) {
        button = new ConstrainedButton(text, minimumWidth);
      } else {
        button = new JButton(text);
      }
      if (icon != null) {
        button.setIcon(icon);
      }
      if (mnemonic != 0) {
        button.setMnemonic(mnemonic);
      }
      return button;
    }
  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;
  }
  // 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;
  }
示例#21
0
  /** Initializes the call button. */
  private void initSMSButton() {
    if (!parentWindow.hasOperationSet(OperationSetSmsMessaging.class)) return;

    smsButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.SEND_SMS"));

    smsButton.setIcon(GuiActivator.getResources().getImage("service.gui.icons.SMS_BUTTON_ICON"));

    buttonPanel.add(smsButton);

    smsButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            final String searchText = parentWindow.getCurrentSearchText();

            if (searchText == null) return;

            SMSManager.sendSMS(smsButton, searchText);
          }
        });
  }
    private void initComponents() {

      setPreferredSize(new java.awt.Dimension(420, 65));

      this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
      JPanel textPanel = new JPanel();
      SpringLayout textLayout = new SpringLayout();
      textPanel.setLayout(textLayout);
      this.add(buttonPanel);
      this.add(textPanel);

      // button area
      abortButton_ = new JButton();
      abortButton_.setBackground(new java.awt.Color(255, 255, 255));
      abortButton_.setIcon(
          new javax.swing.ImageIcon(
              getClass().getResource("/org/micromanager/icons/cancel.png"))); // NOI18N
      abortButton_.setToolTipText("Abort acquisition");
      abortButton_.setFocusable(false);
      abortButton_.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
      abortButton_.setMaximumSize(new java.awt.Dimension(30, 28));
      abortButton_.setMinimumSize(new java.awt.Dimension(30, 28));
      abortButton_.setPreferredSize(new java.awt.Dimension(30, 28));
      abortButton_.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
      abortButton_.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              try {
                JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "abort");
              } catch (Exception ex) {
                ReportingUtils.showError(
                    "Couldn't abort. Try pressing stop on Multi-Dimensional acquisition Window");
              }
            }
          });
      buttonPanel.add(abortButton_);

      pauseButton_ = new JButton();
      pauseButton_.setIcon(
          new javax.swing.ImageIcon(
              getClass().getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N
      pauseButton_.setToolTipText("Pause acquisition");
      pauseButton_.setFocusable(false);
      pauseButton_.setMargin(new java.awt.Insets(0, 0, 0, 0));
      pauseButton_.setMaximumSize(new java.awt.Dimension(30, 28));
      pauseButton_.setMinimumSize(new java.awt.Dimension(30, 28));
      pauseButton_.setPreferredSize(new java.awt.Dimension(30, 28));
      pauseButton_.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              try {
                JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "pause");
              } catch (Exception ex) {
                ReportingUtils.showError("Couldn't pause");
              }
              if (eng_.isPaused()) {
                pauseButton_.setIcon(
                    new javax.swing.ImageIcon(
                        getClass()
                            .getResource("/org/micromanager/icons/resultset_next.png"))); // NOI18N
              } else {
                pauseButton_.setIcon(
                    new javax.swing.ImageIcon(
                        getClass()
                            .getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N
              }
            }
          });
      buttonPanel.add(pauseButton_);

      gridXSpinner_ = new JSpinner();
      gridXSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1));
      gridXSpinner_.setPreferredSize(new Dimension(35, 24));
      gridYSpinner_ = new JSpinner();
      gridYSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1));
      gridYSpinner_.setPreferredSize(new Dimension(35, 24));
      gridXSpinner_.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              gridSizeChanged();
            }
          });
      gridYSpinner_.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              gridSizeChanged();
            }
          });
      final JLabel gridLabel = new JLabel(" grid");
      final JLabel byLabel = new JLabel("by");
      gridLabel.setEnabled(false);
      byLabel.setEnabled(false);
      gridXSpinner_.setEnabled(false);
      gridYSpinner_.setEnabled(false);

      final JButton createGridButton = new JButton("Create");
      createGridButton.setEnabled(false);
      createGridButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              createGrid();
            }
          });

      newGridButton_ = new JToggleButton("New grid");
      buttonPanel.add(new JLabel("    "));
      buttonPanel.add(newGridButton_);
      newGridButton_.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              if (newGridButton_.isSelected()) {
                makeGridOverlay(
                    vad_.getImagePlus().getWidth() / 2, vad_.getImagePlus().getHeight() / 2);
                newGridButton_.setText("Cancel");
                gridLabel.setEnabled(true);
                byLabel.setEnabled(true);
                gridXSpinner_.setEnabled(true);
                gridYSpinner_.setEnabled(true);
                createGridButton.setEnabled(true);
              } else {
                vad_.getImagePlus().getOverlay().clear();
                vad_.getImagePlus().getCanvas().repaint();
                newGridButton_.setText("New grid");
                gridLabel.setEnabled(false);
                byLabel.setEnabled(false);
                gridXSpinner_.setEnabled(false);
                gridYSpinner_.setEnabled(false);
                createGridButton.setEnabled(false);
              }
            }
          });

      buttonPanel.add(gridXSpinner_);
      buttonPanel.add(byLabel);
      buttonPanel.add(gridYSpinner_);
      buttonPanel.add(gridLabel);
      buttonPanel.add(createGridButton);

      // text area
      zPosLabel_ = new JLabel("Z position:                    ");
      textPanel.add(zPosLabel_);

      timeStampLabel_ = new JLabel("Elapsed time:                               ");
      textPanel.add(timeStampLabel_);

      fpsField_ = new JTextField();
      fpsField_.setText("7");
      fpsField_.setToolTipText("Set the speed at which the acquisition is played back.");
      fpsField_.setPreferredSize(new Dimension(25, 18));
      fpsField_.addFocusListener(
          new java.awt.event.FocusAdapter() {

            public void focusLost(java.awt.event.FocusEvent evt) {
              updateFPS();
            }
          });
      fpsField_.addKeyListener(
          new java.awt.event.KeyAdapter() {

            public void keyReleased(java.awt.event.KeyEvent evt) {
              updateFPS();
            }
          });
      JLabel fpsLabel = new JLabel("Animation playback FPS: ");
      textPanel.add(fpsLabel);
      textPanel.add(fpsField_);

      textLayout.putConstraint(SpringLayout.WEST, textPanel, 0, SpringLayout.WEST, zPosLabel_);
      textLayout.putConstraint(
          SpringLayout.EAST, zPosLabel_, 0, SpringLayout.WEST, timeStampLabel_);
      textLayout.putConstraint(SpringLayout.EAST, timeStampLabel_, 0, SpringLayout.WEST, fpsLabel);
      textLayout.putConstraint(SpringLayout.EAST, fpsLabel, 0, SpringLayout.WEST, fpsField_);
      textLayout.putConstraint(SpringLayout.EAST, fpsField_, 0, SpringLayout.EAST, textPanel);

      textLayout.putConstraint(SpringLayout.NORTH, fpsField_, 0, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(SpringLayout.NORTH, zPosLabel_, 3, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(
          SpringLayout.NORTH, timeStampLabel_, 3, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(SpringLayout.NORTH, fpsLabel, 3, SpringLayout.NORTH, textPanel);
    }
示例#23
0
  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);
  }
示例#24
0
 /** Reloads search button icon. */
 public void loadSkin() {
   searchButton.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.SEARCH_ICON)));
 }
示例#25
0
  // action listeners
  public void actionPerformed(ActionEvent e) {

    // doge click button gives doge
    if (e.getSource() == dogeClick) {

      cps = cps + 1;

      Sounds.run("wow");

      // increases size of button temporarily
      if (animation == 0) {
        dogeClick.setBounds(460, 110, 80, 80);
        dogeClick.setIcon(new ImageIcon("Images/dogeopen.jpg"));
        animation = 1;

      } else if (animation == 1) {
        dogeClick.setBounds(450, 100, 100, 100);
        dogeClick.setIcon(new ImageIcon("Images/doge.jpg"));
        animation = 0;
      }

      // adds doge accordingly and updates JLabel
      doge = doge + ((clickUpgrade) * clickMultiply) * multiplier;
      dogeCount.setText("Doge: " + doge);

      // randomize text
      flavourClick.setText(flavourText[(int) (Math.random() * 49)]);
      flavourClick.setBounds(
          (int) (Math.random() * (800)), (int) ((Math.random() * (401)) + 50), getWidth(), 50);
      flavourClick.setFont(
          new Font("Comic Sans MS", Font.BOLD, (int) ((Math.random() * (15)) + 15)));
      Color colour = Random.getRandomColour();
      flavourClick.setForeground(colour);
      flavourClick.setVisible(true);
    }
    // for loop for all buttons
    for (int i = 0; i < MAX_UPGRADES; i++) {

      // updates button stats and count
      if (e.getSource() == producers[i] && doge >= producerStats[i].getCost()) {

        doge = doge - producerStats[i].getCost();
        producers[i].setIcon(new ImageIcon("Images//bought.PNG"));
        producerStats[i].increaseCount();
        producerStats[i].increaseCost();
        producers[i].setToolTipText(
            "Your "
                + producerStats[i].getButtonName()
                + " gives "
                + producerStats[i].getDogeProduction() * producerStats[i].getCount()
                + " doge per second");
        dps = dps + producerStats[i].getDogeProduction();
        buyProducers[i].setText(
            "Buy "
                + producerStats[i].getButtonName()
                + " for "
                + producerStats[i].getCost()
                + " doge");
        buyDetails[i].setText(
            "You have: " + producerStats[i].getCount() + " " + producerStats[i].getButtonName());
      }
    }
    // updates click stats and count
    for (int i = 0; i < MAX_CLICK; i++) {
      if (e.getSource() == clickers[i] && doge >= clickerStats[i].getCost()) {

        doge = doge - clickerStats[i].getCost();
        clickerStats[i].increaseCount();
        clickUpgrade = clickUpgrade + clickerStats[i].getClickBonus();
        clickMultiply = clickMultiply * clickerStats[i].getClickMultiplier();
        dogeClick.setToolTipText(
            "Each click gives you " + (clickUpgrade) * clickMultiply + " doge. wow");

        clickers[i].setVisible(false);
        buyClickers[i].setVisible(false);
      }
    }

    // secret developer button in corner
    if (e.getSource() == devButton) {

      doge = doge * 2;

      // plays Sandstorm by Darude
      Sounds.run("sandstorm");
    }
    if (e.getSource() == options) {

      // opens options gui
      Options options = new Options();
    }
    // saves current progress into save file
    if (e.getSource() == save) {

      // opens JOtionPane
      Sounds.run("save");
      Save temp = new Save();
      String name = JOptionPane.showInputDialog("What is the name of your save file?");
      temp.createOutputFile("Save//" + name + ".txt");

      String producerCount = "";
      String clickCount = "";
      String achievementCount = "";

      // adds line of code for the amount of producers
      for (int i = 0; i < MAX_UPGRADES; i++) {

        producerCount = producerCount + producerStats[i].getCount() + "|";
      }
      // adds line of code for the amount of clickers
      for (int i = 0; i < MAX_CLICK; i++) {

        // if bought write true
        if (clickerStats[i].getCount() != 0) {
          clickCount = clickCount + "t|";
        } else {
          // if not bought write false
          clickCount = clickCount + "f|";
        }
      }

      // adds a line of code for achievements
      for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {

        // if possess write true
        if (achievementStats[i].getCount() != 0) {
          achievementCount = achievementCount + "t|";
        } else {
          // if do not have write f
          achievementCount = achievementCount + "f|";
        }
      }

      // add all lines to file
      temp.addInfo("" + doge);
      temp.addInfo("" + producerCount);
      temp.addInfo("" + clickCount);
      temp.addInfo("" + achievementCount);
      temp.closeOutputFile();
    }
    // opens existing save file
    if (e.getSource() == open) {

      Save temp = new Save();
      String name = JOptionPane.showInputDialog("What is the name of your save file?");
      temp.openInputFile("Save//" + name + ".txt");
      try {

        // counters to open save file
        int add = 0;
        String data = "";
        int producerCount = 0;
        int clickCount = 0;
        int achievementCount = 0;

        // turn each line into char array
        doge = Long.parseLong(temp.getInfo());
        char producerSave[] = temp.getInfo().toCharArray();
        char clickSave[] = temp.getInfo().toCharArray();
        char achievementSave[] = temp.getInfo().toCharArray();

        // looks at producer line and adjusts values and resets Jlabel
        // text
        for (int i = 0; i < producerSave.length; i++) {

          if (producerSave[i] != '|') {

            data = data + Character.getNumericValue(producerSave[i]);

          } else {

            // updates data in producers
            add = Integer.parseInt(data);
            producerStats[producerCount].setCount(add);
            producerStats[producerCount].setCost(
                (int)
                    (producerStats[producerCount].getCost()
                        * (add * producerStats[producerCount].getCostIncrease())));
            buyProducers[producerCount].setText(
                "Buy "
                    + producerStats[producerCount].getButtonName()
                    + " for "
                    + producerStats[producerCount].getCost()
                    + " doge");
            buyDetails[producerCount].setText(
                "You have: "
                    + producerStats[producerCount].getCount()
                    + " "
                    + producerStats[producerCount].getButtonName());
            producers[producerCount].setToolTipText(
                "Your "
                    + producerStats[producerCount].getButtonName()
                    + " gives "
                    + producerStats[producerCount].getDogeProduction()
                        * producerStats[producerCount].getCount()
                    + " doge per second");
            dps =
                dps
                    + (producerStats[producerCount].getDogeProduction()
                        * producerStats[producerCount].getCount());

            data = "";
            producerCount++;
            add = 0;
          }
        }
        // reads clicker upgrades saves
        for (int i = 0; i < MAX_CLICK * 2; i++) {

          if (clickSave[i] == 't') {

            // updates data in clickers
            clickerStats[clickCount].setCount(1);
            clickUpgrade =
                (clickUpgrade + clickerStats[clickCount].getClickBonus())
                    * clickerStats[clickCount].getClickMultiplier();
            dogeClick.setToolTipText("Each click gives you " + clickUpgrade + " doge. wow");

            clickers[clickCount].setVisible(false);
            buyClickers[clickCount].setVisible(false);

            clickCount++;

          } else if (clickSave[i] == 'f') {
            clickCount++;
          }
        }
        // reads achievement lines
        for (int i = 0; i < MAX_ACHIEVEMENTS * 2; i++) {

          if (achievementSave[i] == 't') {

            // updates achievements
            achievementStats[achievementCount].setCount(1);
            achievements[achievementCount].setVisible(true);

            achievementCount++;

          } else if (achievementSave[i] == 'f') {
            achievementCount++;
          }
        }

        dogeCount.setText("Doge: " + doge);
      } catch (IOException e1) {
        // access invalid file
        e1.printStackTrace();
        System.out.println("Invalid file!");
      }

      // closes input file
      try {
        temp.closeInputFile();
      } catch (IOException e1) {
        // access invalid file
        e1.printStackTrace();
        System.out.println("Invalid file!");
      }
    }
  }
示例#26
0
  private void createUI() {

    setTitle(strings.getString("window.title"));

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    mailBodyArea = new JTextArea(20, 70);
    mailBodyArea.setLineWrap(true);
    mailBodyArea.setWrapStyleWord(true);
    mailBodyArea.setFont(new Font("monospaced", Font.PLAIN, 12));

    scrollPane = new JScrollPane(mailBodyArea);

    mailSubjectField = new JTextField(20);
    mailToField = new JTextField(20);
    mailFromField = new JTextField(20);

    mailSubjectLabel = new JLabel(strings.getString("subject.label"));
    mailToLabel = new JLabel(strings.getString("to.label"));
    setToFieldEditable(false);

    toLabelListener =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            mouseClicked_searchSource();
          }

          public void mouseEntered(MouseEvent e) {
            setCursor(new Cursor(Cursor.HAND_CURSOR));
          }

          public void mouseExited(MouseEvent e) {
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
          }
        };

    mailFromLabel = new JLabel(strings.getString("from.label"));

    sendMailButton = new JButton(strings.getString("sendmail.text"));
    sendMailButton.setIcon(
        new ImageIcon(getClass().getResource(strings.getString("sendmail.icon"))));
    sendMailButton.setToolTipText(strings.getString("sendmail.tooltip"));
    cancelButton = new JButton(strings.getString("cancel.text"));
    cancelButton.setIcon(new ImageIcon(getClass().getResource(strings.getString("cancel.icon"))));
    cancelButton.setToolTipText(strings.getString("cancel.tooltip"));

    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            actionPerformed_cancel();
          }
        });

    sendMailButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            actionPerformed_sendMail();
          }
        });

    Container pane = this.getContentPane();

    container.setLayout(gridbag);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 0, 5);
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.EAST;
    pane.add(mailFromLabel, c);
    c.gridx = 1;
    pane.add(mailFromField, c);

    c.gridx = 0;
    c.gridy = 1;
    pane.add(mailToLabel, c);
    c.gridx = 1;
    pane.add(mailToField, c);

    c.gridx = 0;
    c.gridy = 2;
    pane.add(mailSubjectLabel, c);
    c.gridx = 1;
    pane.add(mailSubjectField, c);

    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 2;
    pane.add(scrollPane, c);

    JPanel bPane = new JPanel();
    bPane.add(sendMailButton);
    bPane.add(cancelButton);

    c.gridx = 0;
    c.gridy = 4;
    pane.add(bPane, c);

    mailToField.requestFocus();
  }
  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);
  }
示例#28
0
  /** 程式的GUI畫面配置,並登入按鈕、選項監聽。 */
  private void GUI() {
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);

    JMenuItem file_newMenuItem = new JMenuItem("New");
    file_newMenuItem.setIcon(
        new ImageIcon(
            DocumentEditGUI.class.getResource("/javax/swing/plaf/metal/icons/ocean/file.gif")));
    file_newMenuItem.addActionListener(new SystemFileNew());
    fileMenu.add(file_newMenuItem);

    JMenuItem file_openMenuItem = new JMenuItem("Open File...");
    file_openMenuItem.setIcon(
        new ImageIcon(
            DocumentEditGUI.class.getResource(
                "/com/sun/java/swing/plaf/windows/icons/TreeOpen.gif")));
    file_openMenuItem.addActionListener(new SystemFileOpen());
    fileMenu.add(file_openMenuItem);

    JMenu file_saveMenu = new JMenu("Save");
    fileMenu.add(file_saveMenu);

    JMenuItem file_save_saveMenuItem = new JMenuItem("Save");
    file_save_saveMenuItem.setIcon(
        new ImageIcon(
            DocumentEditGUI.class.getResource(
                "/com/sun/java/swing/plaf/windows/icons/FloppyDrive.gif")));
    file_save_saveMenuItem.addActionListener(new SystemFileSave());
    file_save_saveMenuItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
    file_saveMenu.add(file_save_saveMenuItem);

    JMenuItem file_save_save_asMenuItem = new JMenuItem("Save as");
    file_save_save_asMenuItem.addActionListener(new SystemFileSaveAS());
    file_saveMenu.add(file_save_save_asMenuItem);

    JMenuItem file_save_save_allMenuItem = new JMenuItem("Save all");
    file_save_save_allMenuItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK));
    file_save_save_allMenuItem.addActionListener(new SystemFileSaveAll());
    file_saveMenu.add(file_save_save_allMenuItem);

    JMenu file_closeMenu = new JMenu("Close");
    fileMenu.add(file_closeMenu);

    JMenuItem file_close_closeMenuItem = new JMenuItem("Close File");
    file_close_closeMenuItem.addActionListener(new SystemFileClose());
    file_closeMenu.add(file_close_closeMenuItem);

    JMenuItem file_close_close_all_fileMenuItem = new JMenuItem("Close all File");
    file_close_close_all_fileMenuItem.addActionListener(new SystemFileCloseAll());
    file_closeMenu.add(file_close_close_all_fileMenuItem);

    JMenuItem file_exitMenuItem = new JMenuItem("Exit");
    file_exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));
    file_exitMenuItem.addActionListener(new SystemExit());
    fileMenu.add(file_exitMenuItem);

    JMenu editMenu = new JMenu("Edit");
    menuBar.add(editMenu);

    replace_searchMenuItem.addActionListener(replace_search);
    replace_searchMenuItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK));
    editMenu.add(replace_searchMenuItem);

    SystemEditCut_Copy_Paste cut_copy_paste = new SystemEditCut_Copy_Paste();
    cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK));
    cutMenuItem.addActionListener(cut_copy_paste);
    editMenu.add(cutMenuItem);
    copyMenutem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK));

    copyMenutem.addActionListener(cut_copy_paste);
    editMenu.add(copyMenutem);
    pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK));

    pasteMenuItem.addActionListener(cut_copy_paste);
    editMenu.add(pasteMenuItem);

    JMenuItem pathMenuItem = new JMenuItem("Default AutoSave-Path");
    pathMenuItem.addActionListener(new SystemEditSetPath());
    editMenu.add(pathMenuItem);

    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);

    JMenuItem HelpMenuItem = new JMenuItem("Help");
    HelpMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            JOptionPane.showMessageDialog(null, help, "Help!", JOptionPane.INFORMATION_MESSAGE);
          }
        });
    helpMenu.add(HelpMenuItem);

    JMenuItem AboutNewMenuItem = new JMenuItem("About");
    AboutNewMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(null, about, "About...", JOptionPane.INFORMATION_MESSAGE);
          }
        });
    helpMenu.add(AboutNewMenuItem);

    JToolBar toolBar = new JToolBar();
    getContentPane().add(toolBar, BorderLayout.NORTH);

    scrollPane.setViewportView(td);
    JButton newFileButton = new JButton("New");
    newFileButton.setIcon(
        new ImageIcon(
            DocumentEditGUI.class.getResource("/javax/swing/plaf/metal/icons/ocean/file.gif")));
    newFileButton.setToolTipText("New File.");
    newFileButton.addActionListener(new SystemFileNew());
    toolBar.add(newFileButton);

    JButton openFileButton = new JButton("Open");
    openFileButton.setIcon(
        new ImageIcon(
            DocumentEditGUI.class.getResource(
                "/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    openFileButton.setToolTipText("Open File.");
    openFileButton.addActionListener(new SystemFileOpen());
    toolBar.add(openFileButton);

    JButton save_asFileButton = new JButton("Save as");
    save_asFileButton.setToolTipText("Save as File.");
    save_asFileButton.addActionListener(new SystemFileSaveAS());
    toolBar.add(save_asFileButton);

    JButton saveFileButton = new JButton("Save");
    saveFileButton.setIcon(
        new ImageIcon(
            DocumentEditGUI.class.getResource("/javax/swing/plaf/metal/icons/ocean/floppy.gif")));
    saveFileButton.setToolTipText("Savet his File.");
    saveFileButton.addActionListener(new SystemFileSave());
    toolBar.add(saveFileButton);

    JButton save_allFileButton = new JButton("Save all");
    save_allFileButton.setToolTipText("Save all File.");
    save_allFileButton.addActionListener(new SystemFileSaveAll());
    toolBar.add(save_allFileButton);

    JButton closeButton = new JButton("Close");
    closeButton.setToolTipText("Close this file.");
    closeButton.addActionListener(new SystemFileClose());
    toolBar.add(closeButton);

    JButton close_allButton = new JButton("Close all");
    close_allButton.setToolTipText("Close al File.");
    close_allButton.addActionListener(new SystemFileCloseAll());
    toolBar.add(close_allButton);
  }
 public final void setIcon(Icon icon) {
   super.setIcon(new ArrowMultiIcon((ImageIcon) icon));
 }
  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;
  }