コード例 #1
1
  public CustomIconDemo() {
    Icon leftButtonIcon = new ArrowIcon(SwingConstants.RIGHT);
    Icon middleButtonIcon = createImageIcon("images/middle.gif", "the middle button");
    Icon rightButtonIcon = new ArrowIcon(SwingConstants.LEFT);

    b1 = new JButton("Disable middle button", leftButtonIcon);
    b1.setVerticalTextPosition(AbstractButton.CENTER);
    b1.setHorizontalTextPosition(AbstractButton.LEADING);
    b1.setMnemonic(KeyEvent.VK_D);
    b1.setActionCommand("disable");

    b2 = new JButton("Middle button", middleButtonIcon);
    b2.setVerticalTextPosition(AbstractButton.BOTTOM);
    b2.setHorizontalTextPosition(AbstractButton.CENTER);
    b2.setMnemonic(KeyEvent.VK_M);

    b3 = new JButton("Enable middle button", rightButtonIcon);
    // Use the default text position of CENTER, TRAILING (RIGHT).
    b3.setMnemonic(KeyEvent.VK_E);
    b3.setActionCommand("enable");
    b3.setEnabled(false);

    // Listen for actions on buttons 1 and 3.
    b1.addActionListener(this);
    b3.addActionListener(this);

    b1.setToolTipText("Click this button to disable the middle button.");
    b2.setToolTipText("This middle button does nothing when you click it.");
    b3.setToolTipText("Click this button to enable the middle button.");

    // Add Components to this container, using the default FlowLayout.
    add(b1);
    add(b2);
    add(b3);
  }
コード例 #2
0
  /**
   * Constructor
   *
   * @param mainFrame
   */
  public BrowserMenuBar(MainFrame mainFrame) {
    super("Controls");
    this.mainFrame = mainFrame;
    this.folderChooser = new JFileChooser();
    this.setFloatable(false);

    // Prepare listener and FileChooser
    Listener listener = new Listener();
    folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    mainFrame.addIsolatedComponent(folderChooser);

    // Prepare buttons
    try {
      detectFacesButton =
          new JButton(new ImageIcon(ImageIO.read(RessourceLoader.getFile("detect.png"))));
      detectFacesButton.setEnabled(false);
      openFolderButton =
          new JButton(new ImageIcon(ImageIO.read(RessourceLoader.getFile("open.png"))));
    } catch (IOException e) {
      e.printStackTrace();
    }
    this.add(openFolderButton);
    this.add(detectFacesButton);
    openFolderButton.addActionListener(listener);
    detectFacesButton.addActionListener(listener);
    this.addSeparator();

    // Set tool tips
    openFolderButton.setToolTipText("Open Folder...");
    detectFacesButton.setToolTipText("Run Face Detection");
    openFolderButton.setText("Open Folder...");
    detectFacesButton.setText("Run Face Detection");
  }
コード例 #3
0
ファイル: ProductDisplay.java プロジェクト: lindskogen/iMat
 @Override
 public void actionPerformed(ActionEvent evt) {
   if (evt.getActionCommand().equals("buy")) {
     evt.setSource(getItem());
     listener.actionPerformed(evt);
   } else if (evt.getActionCommand().equals("fav")) {
     if (IDH.isFavorite(product)) {
       IDH.removeFavorite(product);
       if (list) {
         favButton.setIcon(
             new ImageIcon(ProductDisplay.class.getResource("/imat/resources/unfavmini.PNG")));
       } else {
         favButton.setIcon(
             new ImageIcon(ProductDisplay.class.getResource("/imat/resources/unfav.PNG")));
       }
       favButton.setToolTipText("Lägg till som favorit");
       listener.actionPerformed(evt);
     } else {
       IDH.addFavorite(product);
       if (list) {
         favButton.setIcon(
             new ImageIcon(ProductDisplay.class.getResource("/imat/resources/favmini.PNG")));
       } else {
         favButton.setIcon(
             new ImageIcon(ProductDisplay.class.getResource("/imat/resources/fav.PNG")));
       }
       listener.actionPerformed(evt);
       favButton.setToolTipText("Ta bort som favorit");
     }
     listener.actionPerformed(evt);
   }
 }
コード例 #4
0
  /** Initializes the button. */
  private void initButtons() {
    final IconManager iconManager = serviceRegistrar.getService(IconManager.class);

    // Create Float / Dock Button
    floatButton = new JButton(ICON_SQUARE_O);
    floatButton.setToolTipText(TOOL_TIP_FLOAT);
    CytoPanelUtil.styleButton(floatButton);
    floatButton.setFont(iconManager.getIconFont(12));
    floatButton.setSelected(true);

    // Create close button
    closeButton = new JButton(ICON_REMOVE);
    closeButton.setToolTipText(TOOL_TIP_CLOSE);
    CytoPanelUtil.styleButton(closeButton);
    closeButton.setFont(iconManager.getIconFont(13));
    closeButton.setSelected(true);

    floatButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (isFloating()) DockCytoPanel();
            else FloatCytoPanel();

            notifyListeners(NOTIFICATION_STATE_CHANGE);
          }
        });

    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setState(CytoPanelState.HIDE);
            notifyListeners(NOTIFICATION_STATE_CHANGE);
          }
        });
  }
コード例 #5
0
 // Initialization this component
 private void jbInit() {
   this.getContentPane().setLayout(null);
   setTitle("Files selection");
   scriptFileChooser.setBounds(new Rectangle(5, 2, 485, 48));
   outputFileChooser.setBounds(new Rectangle(5, 38, 485, 48));
   comparisonFileChooser.setBounds(new Rectangle(5, 74, 485, 48));
   okButton.setToolTipText("OK");
   okButton.setIcon(okIcon);
   okButton.setBounds(new Rectangle(123, 134, 63, 44));
   okButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           okButton_actionPerformed(e);
         }
       });
   cancelButton.setBounds(new Rectangle(283, 134, 63, 44));
   cancelButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           cancelButton_actionPerformed(e);
         }
       });
   cancelButton.setToolTipText("CANCEL");
   cancelButton.setIcon(cancelIcon);
   this.getContentPane().add(scriptFileChooser, null);
   this.getContentPane().add(outputFileChooser, null);
   this.getContentPane().add(comparisonFileChooser, null);
   this.getContentPane().add(okButton, null);
   this.getContentPane().add(cancelButton, null);
   setSize(500, 210);
   setLocation(20, 415);
 }
コード例 #6
0
ファイル: ButtonDemo.java プロジェクト: skysoblue/java-swing
  public ButtonDemo() {
    ImageIcon leftButtonIcon = new ImageIcon("src/images/right.png");
    ImageIcon middleButtonIcon = new ImageIcon("src/images/middle.png");
    ImageIcon rightButtonIcon = new ImageIcon("src/images/left.png");

    b1 = new JButton("가운데 버튼은 사용 불가", leftButtonIcon);
    b1.setVerticalTextPosition(AbstractButton.CENTER);
    b1.setHorizontalTextPosition(AbstractButton.LEADING); // aka LEFT, for left-to-right locales
    b1.setMnemonic(KeyEvent.VK_D);
    b1.setActionCommand("disable");

    b2 = new JButton("Middle button", middleButtonIcon);
    b2.setVerticalTextPosition(AbstractButton.BOTTOM);
    b2.setHorizontalTextPosition(AbstractButton.CENTER);
    b2.setMnemonic(KeyEvent.VK_M);

    b3 = new JButton("Enable middle button", rightButtonIcon);
    // Use the default text position of CENTER, TRAILING (RIGHT).
    b3.setMnemonic(KeyEvent.VK_E);
    b3.setActionCommand("enable");
    b3.setEnabled(false);

    // Listen for actions on buttons 1 and 3.
    b1.addActionListener(this);
    b3.addActionListener(this);

    b1.setToolTipText("Click this button to disable the middle button.");
    b2.setToolTipText("This middle button does nothing when you click it.");
    b3.setToolTipText("Click this button to enable the middle button.");

    // Add Components to this container, using the default FlowLayout.
    add(b1);
    add(b2);
    add(b3);
  }
コード例 #7
0
ファイル: WorkingView.java プロジェクト: BackupTheBerlios/tbe
  /** Install Add and Remove Buttons into the toolbar */
  private void installAddRemovePointButtons() {
    URL imgURL = ClassLoader.getSystemResource("ch/tbe/pics/plus.gif");
    ImageIcon plus = new ImageIcon(imgURL);
    imgURL = ClassLoader.getSystemResource("ch/tbe/pics/minus.gif");
    ImageIcon minus = new ImageIcon(imgURL);
    add = new JButton(plus);
    rem = new JButton(minus);
    add.setToolTipText(workingViewLabels.getString("plus"));
    rem.setToolTipText(workingViewLabels.getString("minus"));
    add.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.addRemovePoint(true);
          }
        });
    rem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.addRemovePoint(false);
          }
        });

    add.setContentAreaFilled(false);
    add.setBorderPainted(false);
    rem.setContentAreaFilled(false);
    rem.setBorderPainted(false);
    toolbar.add(add);
    toolbar.add(rem);
  }
コード例 #8
0
  public JPanel getSlicePanel() {

    final JPanel framePanel = new JPanel();
    framePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    framePanel.setAlignmentY(Component.TOP_ALIGNMENT);
    framePanel.setLayout(new BoxLayout(framePanel, BoxLayout.Y_AXIS));
    framePanel.setBorder(
        BorderFactory.createCompoundBorder(
            spaceY,
            new TitledBorder(
                null,
                Messages.getString("ImageTool.frame"), // $NON-NLS-1$
                TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION,
                TITLE_FONT,
                TITLE_COLOR)));

    ActionState sequence = EventManager.getInstance().getAction(ActionW.SCROLL_SERIES);
    if (sequence instanceof SliderCineListener) {
      SliderCineListener cineAction = (SliderCineListener) sequence;
      final JSliderW frameSlider = cineAction.createSlider(4, true);
      framePanel.add(frameSlider.getParent());

      final JPanel panel_3 = new JPanel();
      panel_3.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
      final JLabel speedLabel = new JLabel();
      speedLabel.setText(
          Messages.getString("ImageTool.cine_speed") + StringUtil.COLON); // $NON-NLS-1$
      panel_3.add(speedLabel);

      final JSpinner speedSpinner = new JSpinner(cineAction.getSpeedModel());
      JMVUtils.formatCheckAction(speedSpinner);
      panel_3.add(speedSpinner);
      final JButton startButton = new JButton();
      startButton.setActionCommand(ActionW.CINESTART.cmd());
      startButton.setPreferredSize(JMVUtils.getBigIconButtonSize());
      startButton.setToolTipText(Messages.getString("ImageTool.cine_start")); // $NON-NLS-1$
      startButton.setIcon(
          new ImageIcon(
              MouseActions.class.getResource(
                  "/icon/22x22/media-playback-start.png"))); //$NON-NLS-1$
      startButton.addActionListener(EventManager.getInstance());
      panel_3.add(startButton);
      cineAction.registerActionState(startButton);

      final JButton stopButton = new JButton();
      stopButton.setActionCommand(ActionW.CINESTOP.cmd());
      stopButton.setPreferredSize(JMVUtils.getBigIconButtonSize());
      stopButton.setToolTipText(Messages.getString("ImageTool.cine_stop")); // $NON-NLS-1$
      stopButton.setIcon(
          new ImageIcon(
              MouseActions.class.getResource(
                  "/icon/22x22/media-playback-stop.png"))); //$NON-NLS-1$
      stopButton.addActionListener(EventManager.getInstance());
      panel_3.add(stopButton);
      cineAction.registerActionState(stopButton);
      framePanel.add(panel_3);
    }
    return framePanel;
  }
コード例 #9
0
ファイル: Menu.java プロジェクト: Rorkien/Ormus
  public Menu(ScriptPane parent) {
    setFloatable(false);
    add(newButton);
    add(openButton);
    add(saveButton);
    add(executeButton);
    add(preferencesButton);

    newButton.setToolTipText(Localization.getString("button.newfile.tooltip"));
    openButton.setToolTipText(Localization.getString("button.openfile.tooltip"));
    saveButton.setToolTipText(Localization.getString("button.savefile.tooltip"));
    executeButton.setToolTipText(Localization.getString("button.executefile.tooltip"));
    preferencesButton.setToolTipText(Localization.getString("button.preferences.tooltip"));

    newButton.setIcon(new ImageIcon(Resources.getImage("button.newfile")));
    openButton.setIcon(new ImageIcon(Resources.getImage("button.openfile")));
    saveButton.setIcon(new ImageIcon(Resources.getImage("button.savefile")));
    executeButton.setIcon(new ImageIcon(Resources.getImage("button.executefile")));
    preferencesButton.setIcon(new ImageIcon(Resources.getImage("button.preferences")));

    newButton.setActionCommand("new");
    openButton.setActionCommand("open");
    saveButton.setActionCommand("save");
    executeButton.setActionCommand("execute");
    preferencesButton.setActionCommand("preferences");

    newButton.addActionListener(parent);
    openButton.addActionListener(parent);
    saveButton.addActionListener(parent);
    executeButton.addActionListener(parent);
    preferencesButton.addActionListener(parent);
  }
コード例 #10
0
  // Audio recording\mixing
  private void audioEditor() {
    audioStudio.setLayout(null);

    record = new JButton("Record");
    record.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    record.setToolTipText("Record Audio");
    record.setBounds((width / 2) - 160, 0, 80, 25);
    audioStudio.add(record);

    audioStudio.add(audioformat);
    audioformat.setBounds(0, 0, 80, 25);
    audioformat.add("Wav");
    audioformat.add("AIFC");
    audioformat.add("AIFF");
    audioformat.add("AU");
    audioformat.add("SND");

    audioStudio.add(sampleRate);
    sampleRate.setBounds(80, 0, 80, 25);
    sampleRate.add("8000");
    sampleRate.add("11025");
    sampleRate.add("16000");
    sampleRate.add("22050");
    sampleRate.add("44100");

    audioStudio.add(channels);
    channels.setBounds(160, 0, 80, 25);
    channels.add("Mono");
    channels.add("Stereo");

    playaudio = new JButton("Play");
    playaudio.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    playaudio.setToolTipText("Play recording");
    playaudio.setBounds((width / 2), 0, 80, 25);
    audioStudio.add(playaudio);

    stopBtn = new JButton("Stop");
    stopBtn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    stopBtn.setToolTipText("Stop Recording");
    stopBtn.setBounds((width / 2) - 80, 0, 80, 25);
    audioStudio.add(stopBtn);

    record.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            audio.captureAudio();
            System.out.println(audio.getAudioFormat().getSampleRate());
            System.out.println(audio.getAudioFormat().getChannels());
            audio.audnum++;
          }
        });

    stopBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            audio.targetDataLine.stop();
            audio.targetDataLine.close();
          }
        });
  }
コード例 #11
0
ファイル: JMapViewer.java プロジェクト: ToeBee/OSMZmiany
 /**
  * Every time the zoom level changes this method is called. Override it in derived implementations
  * for adapting zoom dependent values. The new zoom level can be obtained via {@link #getZoom()}.
  *
  * @param oldZoom the previous zoom level
  */
 protected void zoomChanged(int oldZoom) {
   zoomSlider.setToolTipText("Zoom level " + zoom);
   zoomInButton.setToolTipText("Zoom to level " + (zoom + 1));
   zoomOutButton.setToolTipText("Zoom to level " + (zoom - 1));
   zoomOutButton.setEnabled(zoom > tileController.getTileSource().getMinZoom());
   zoomInButton.setEnabled(zoom < tileController.getTileSource().getMaxZoom());
   fireMapViewChanged();
 }
コード例 #12
0
ファイル: MainSmarxFrame.java プロジェクト: SnoopInf/pzks
  protected JToolBar getToolBar(int orientation) {
    JToolBar toolBar = new JToolBar(orientation);
    toolBar.setFloatable(false);

    ImageIcon openIcon = Utils.createImageIcon(iconsPath + "/open.png");
    JButton openButton = new JButton(openAction);
    openButton.setIcon(openIcon);
    openButton.setToolTipText(STRINGS.OPEN);

    ImageIcon saveIcon = Utils.createImageIcon(iconsPath + "/save.png");
    JButton saveButton = new JButton(saveAsAction);
    saveButton.setIcon(saveIcon);
    saveButton.setToolTipText(STRINGS.SAVE);

    ImageIcon taskIcon = Utils.createImageIcon(CONSTANTS.iconsPath + "/task.png");
    JButton genTaskGraphButton = new JButton(genTaskGraphAction);
    genTaskGraphButton.setIcon(taskIcon);
    genTaskGraphButton.setToolTipText(STRINGS.GEN_TASK_GRAPH);

    ImageIcon systemIcon = Utils.createImageIcon(iconsPath + "/system.png");
    JButton genSystemGraphButton = new JButton(systemIcon);
    genSystemGraphButton.setToolTipText(STRINGS.GEN_SYSTEM_GRAPH);

    ImageIcon nodeIcon = Utils.createImageIcon(iconsPath + "/node.png");
    JButton newNodeButton = new JButton(new NodeCreationToolAction(this));
    newNodeButton.setIcon(nodeIcon);

    ImageIcon linkIcon = Utils.createImageIcon(iconsPath + "/link.png");
    JButton newLinkButton = new JButton(new LinkCreationToolAction(this));
    newLinkButton.setIcon(linkIcon);

    ImageIcon selectIcon = Utils.createImageIcon(iconsPath + "/select.png");
    JButton selectButton = new JButton(new SelectionDraggingToolAction(this));
    selectButton.setIcon(selectIcon);

    ImageIcon removeIcon = Utils.createImageIcon(iconsPath + "/remove.png");
    JButton removeButton = new JButton(new RemoveAction(this));
    removeButton.setIcon(removeIcon);

    ImageIcon queueIcon = Utils.createImageIcon(iconsPath + "/queue.png");
    JButton queueButton = new JButton(new QueueAction(this));
    queueButton.setIcon(queueIcon);

    toolBar.add(newNodeButton);
    toolBar.add(newLinkButton);
    toolBar.add(selectButton);
    toolBar.add(removeButton);
    toolBar.addSeparator();
    toolBar.add(queueButton);
    //        toolBar.add(genTaskGraphButton);
    //        toolBar.add(genSystemGraphButton);
    toolBar.addSeparator();
    toolBar.add(openButton);
    toolBar.add(saveButton);
    toolBar.addSeparator();

    return toolBar;
  }
コード例 #13
0
 /** Creates and displays the main GUI This GUI has the list and the main * buttons */
 public void showGUI() {
   final JScrollPane scrollPane = new JScrollPane();
   table =
       new JTable(
           new DefaultTableModel(
               new Object[][] {}, new String[] {"Username", "Password", "Pin", "Reward"}));
   AccountManager.loadAccounts();
   if (AccountManager.hasAccounts()) {
     for (Account account : AccountManager.getAccounts()) {
       ((DefaultTableModel) table.getModel())
           .addRow(
               new Object[] {
                 account.getUsername(), account.getReward(), account.getPin(), account.getReward()
               });
     }
   }
   final JToolBar bar = new JToolBar();
   bar.setMargin(new Insets(1, 1, 1, 1));
   bar.setFloatable(false);
   removeButton = new JButton("Remove");
   final JButton newButton = new JButton("Add");
   final JButton doneButton = new JButton("Save");
   table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   table.getSelectionModel().addListSelectionListener(new TableSelectionListener());
   table.setShowGrid(true);
   final TableColumnModel cm = table.getColumnModel();
   cm.getColumn(cm.getColumnIndex("Password")).setCellRenderer(new PasswordCellRenderer());
   cm.getColumn(cm.getColumnIndex("Password")).setCellEditor(new PasswordCellEditor());
   cm.getColumn(cm.getColumnIndex("Pin")).setCellRenderer(new PasswordCellRenderer());
   cm.getColumn(cm.getColumnIndex("Pin")).setCellEditor(new PasswordCellEditor());
   cm.getColumn(cm.getColumnIndex("Reward")).setCellEditor(new RandomRewardEditor());
   scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   scrollPane.setViewportView(table);
   add(scrollPane, BorderLayout.CENTER);
   newButton.setFocusable(false);
   newButton.setToolTipText(newButton.getText());
   newButton.setText("+");
   bar.add(newButton);
   removeButton.setFocusable(false);
   removeButton.setToolTipText(removeButton.getText());
   removeButton.setText("-");
   bar.add(removeButton);
   bar.add(Box.createHorizontalGlue());
   doneButton.setToolTipText(doneButton.getText());
   bar.add(doneButton);
   newButton.addActionListener(this);
   removeButton.addActionListener(this);
   doneButton.addActionListener(this);
   add(bar, BorderLayout.SOUTH);
   final int row = table.getSelectedRow();
   removeButton.setEnabled(row >= 0 && row < table.getRowCount());
   table.clearSelection();
   doneButton.requestFocus();
   setPreferredSize(new Dimension(600, 300));
   pack();
   setLocationRelativeTo(getOwner());
   setResizable(false);
 }
コード例 #14
0
  // Draws the buttons and adds functions to them
  private void drawButtons() {

    playAnim = new JButton("Play");
    playAnim.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    playAnim.setBounds((width / 2) + 30, 750, 80, 25);
    playAnim.setToolTipText("Play Animation");
    window.add(playAnim);

    cap = new JButton("Capture");
    cap.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    rcap = new Rectangle((width / 2) - 50, 750, 80, 25);
    cap.setBounds(rcap);
    cap.setToolTipText("Capture Frame");
    window.add(cap);

    // Not working right
    playAnim.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent action) {
            if (canon == true) {
              renderCanon.setIcon(null);
            } else if (webcam == true) {
              for (int i = 0; i < framename; i++) {
                images = new ImageIcon(Save_Algorithm.imgdir + "\\image_" + i + ".tiff");
                //                        renderWebcam.setIcon(null);
                //                        renderWebcam.setIcon(images);
                //                        renderWebcam.revalidate();
                System.out.println(images);
              }
            }
          }
        });

    cap.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            try {
              if (canon == true) {
                sound();
                camera.execute(new ShootTask(filename()));
                System.out.println("Frame Captured from Canon SLR at... " + Save_as.pathname);
                framename++;
              } else if (canon == false) {
                opencv_core.IplImage img = frame.frame();
                sound();
                cvSaveImage(Save_Algorithm.imgdir + "\\image_" + framename + ".tiff", img);
                System.out.println("Frame Captured from Webcam at... " + Save_as.pathname);
                framename++;
              }
            } catch (RuntimeException e) {
              throw e;
            } catch (Exception e) {
              throw e;
            }
          }
        });
  }
コード例 #15
0
 // Modifies button text and tool tips
 private void setPrintButtonText() {
   if (trainManager.isPrintPreviewEnabled()) {
     printButton.setText(Bundle.getMessage("Preview"));
     printButton.setToolTipText(Bundle.getMessage("PreviewSelectedTip"));
   } else {
     printButton.setText(Bundle.getMessage("Print"));
     printButton.setToolTipText(Bundle.getMessage("PrintSelectedTip"));
   }
 }
コード例 #16
0
 /** Set the tool tip texts (used for language change, and at initialization labels). */
 public void setLabels() {
   btnColumns.setToolTipText(loc.getMenuTooltip("Columns"));
   btnOptions.setToolTipText(loc.getMenuTooltip("Options"));
   btnExport.setToolTipText(loc.getPlainTooltip("ExportAsWebpage"));
   btnPrint.setToolTipText(loc.getMenuTooltip("Print"));
   btnHelp.setToolTipText(loc.getMenuTooltip("FastHelp"));
   miShowOnlyBreakpoints.setText(loc.getPlain("ShowOnlyBreakpoints"));
   miColorfulConstructionProtocol.setText(loc.getPlain("ColorfulConstructionProtocol"));
 }
コード例 #17
0
  public static void framecreation() {
    int framesizex = 400;
    int framesizey = 600;

    frame = new JFrame("TwitchBot: Connection-Window");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setResizable(false);

    JPanel panel = new JPanel();
    panel.setLayout(null);

    status = new JLabel();
    status.setText("Bereit");
    status.setBounds(50, 550, 300, 15);
    JLabel statusbeschr = new JLabel();
    statusbeschr.setBounds(5, 550, 50, 15);
    statusbeschr.setText("Status: ");
    JLabel twitchnamelabel = new JLabel("Twitch Name");
    twitchnamelabel.setBounds(10, 50, 80, 25);

    JTextField twitchname = new JTextField("Twitch Channel");
    twitchname.setBounds(90, 50, 300, 25);
    twitchname.setText(main.Streamername);
    twitchname.setToolTipText("Enter here your Twitch Name.");

    JButton connect = new JButton();
    connect.setBounds(270, 520, 100, 25);
    connect.setText("Verbinden");
    connect.setToolTipText("Connect");
    connect.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            main.botconnection();
          }
        });
    JButton cancel = new JButton();
    cancel.setBounds(30, 520, 100, 25);
    cancel.setText("Abbrechen");
    cancel.setToolTipText("Cancel");

    panel.add(connect);
    panel.add(twitchnamelabel);
    panel.add(twitchname);
    panel.add(cancel);
    panel.add(statusbeschr);
    panel.add(status);
    frame.add(panel);

    Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setSize(framesizex, framesizey);
    frame.setLocation(
        screensize.width / 2 - frame.getSize().width / 2,
        screensize.height / 2 - frame.getSize().height / 2);
    frame.setVisible(true);
  }
コード例 #18
0
 private void onKurseSuchenModelCompleted(boolean completed) {
   LOGGER.trace("KurseSemesterwahlModel completed=" + completed);
   if (completed) {
     btnOk.setToolTipText(null);
     btnOk.setEnabled(true);
   } else {
     btnOk.setToolTipText("Bitte Eingabedaten vervollständigen");
     btnOk.setEnabled(false);
   }
 }
コード例 #19
0
 public void update(Network network) {
   this.network = network;
   if (network.isDirected()) {
     btnFilterUndirectedGraph.setEnabled(false);
     btnFilterUndirectedGraph.setToolTipText("Graph is directed.");
   } else {
     btnFilterDirectedGraph.setEnabled(false);
     btnFilterDirectedGraph.setToolTipText("Graph is not directed.");
   }
 }
コード例 #20
0
  /**
   * Refreshes the undo/redo icons with the last action performed.
   *
   * @param oUndoManager, the manager to use to check for undo/redo possibilities.
   */
  public void refreshUndoRedo(UndoManager oUndoManager) {

    // refresh undo
    pbUndo.setToolTipText(oUndoManager.getUndoPresentationName());
    pbUndo.setEnabled(oUndoManager.canUndo());

    // refresh redo
    pbRedo.setToolTipText(oUndoManager.getRedoPresentationName());
    pbRedo.setEnabled(oUndoManager.canRedo());
  }
コード例 #21
0
 private void setStyleList(JButton btn, String styles) {
   if ("".equals(styles)) {
     btn.setToolTipText(null);
     btn.setText(" ");
     return;
   }
   btn.setToolTipText(HtmlUtils.plainToHTML(styles));
   final String text = styles.replaceAll("\n", ", ");
   btn.setText(text);
 }
コード例 #22
0
ファイル: TrainsTableFrame.java プロジェクト: jasblevins/JMRI
 // Modifies button text and tool tips
 private void setPrintButtonText() {
   if (printPreviewBox.isSelected()) {
     printButton.setText(Bundle.getMessage("Preview"));
     printButton.setToolTipText(Bundle.getMessage("PreviewSelectedTip"));
     buildReportBox.setToolTipText(Bundle.getMessage("BuildReportPreviewTip"));
   } else {
     printButton.setText(Bundle.getMessage("Print"));
     printButton.setToolTipText(Bundle.getMessage("PrintSelectedTip"));
     buildReportBox.setToolTipText(Bundle.getMessage("BuildReportPrintTip"));
   }
 }
コード例 #23
0
  // -------------------------------------------------------------------------------------
  protected JPanel createScrolledPdfViewer(String clusterIdAs3DigitString) {
    final PdfDecoder pdfDecoder = new PdfDecoder();
    String urlString =
        baseUrl + "/" + imageFileNameBase + clusterIdAs3DigitString + imageFileNameSuffix;
    currentFile = urlString;

    System.out.println("url: " + urlString);
    try {
      pdfDecoder.openPdfFileFromURL(urlString);
      // System.out.println ("page count: " + pdfDecoder.getPageCount ());
      pdfDecoder.decodePage(1);
      pdfDecoder.setPageParameters(1.0f, 1, PAGE_ROTATION); // values scaling (1=100%). page number
      pdfDecoder.invalidate();
    } catch (Exception e) {
      e.printStackTrace();
    }

    final ViewerState viewerState = new ViewerState(pdfDecoder.getPageCount());

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);
    panel.add(toolbar, BorderLayout.NORTH);

    JButton backButton = new JButton("<");
    backButton.setToolTipText("Back One page");
    toolbar.add(backButton);
    backButton.addActionListener(new BackButtonListener(pdfDecoder, viewerState));

    JButton forwardButton = new JButton(">");
    forwardButton.setToolTipText("Forward One page");
    toolbar.add(forwardButton);
    forwardButton.addActionListener(new ForwardButtonListener(pdfDecoder, viewerState));

    JButton zoomOutButton = new JButton("-");
    zoomOutButton.setToolTipText("Zoom Out");
    toolbar.add(zoomOutButton);
    zoomOutButton.addActionListener(new ZoomOutButtonListener(pdfDecoder, viewerState));

    JButton zoomInButton = new JButton("+");
    zoomInButton.setToolTipText("Zoom In");
    toolbar.add(zoomInButton);
    zoomInButton.addActionListener(new ZoomInButtonListener(pdfDecoder, viewerState));

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    scrollPane.setViewportView(pdfDecoder);
    panel.add(scrollPane, BorderLayout.CENTER);
    return panel;
  } // createScrolledPdfViewer
コード例 #24
0
  /** Enters full screen mode and changes the display mode. */
  public void setFullScreen(DisplayMode displayMode, JFrame window) {

    window.setUndecorated(true);
    window.setResizable(false);
    cmdemo bgd = new cmdemo();
    JList mission = new JList(string);
    mission.setVisibleRowCount(4);
    JScrollPane pane = new JScrollPane(mission);
    pane.setBounds(400, 400, 225, 70);
    window.getContentPane().add(pane);

    muButton.setBounds(764 - 120, 625 - 10, 225, 49);
    textField1.setBounds(630 - 120, 328 - 10, 225, 25);
    window.getContentPane().add(muButton);
    window.getContentPane().add(textField1);
    // window.add(bgd);
    muButton.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    muButton.setToolTipText("start");
    muButton.setBorder(null);
    muButton.setRolloverIcon(new javax.swing.ImageIcon("imgs/start1.jpg"));
    muButton.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent evt) {
            startActionPerformed(evt);
          }
        });

    aButton.setBounds(284 - 120, 625 - 10, 225, 49);
    window.getContentPane().add(aButton);
    window.add(bgd);
    aButton.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    aButton.setToolTipText("back");
    aButton.setBorder(null);
    aButton.setRolloverIcon(new javax.swing.ImageIcon("imgs/back1.jpg"));

    aButton.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent evt) {
            backActionPerformed(evt);
          }
        });

    device.setFullScreenWindow(window);
    if (displayMode != null && device.isDisplayChangeSupported()) {
      try {
        device.setDisplayMode(displayMode);
      } catch (IllegalArgumentException ex) {
        // ignore - illegal mode for this device
      }
    }
  }
コード例 #25
0
 protected void setButtonText() {
   final String text =
       script.substring(0, Math.min(40, script.length())).trim().replaceAll("\\s+", " ");
   if (!text.equals("")) {
     showEditorBtn.setToolTipText(HtmlUtils.plainToHTML(script));
     showEditorBtn.setText(text);
   } else {
     final String title = TextUtils.getText("EditScript");
     showEditorBtn.setToolTipText(null);
     showEditorBtn.setText(title);
   }
 }
コード例 #26
0
ファイル: AnuncisModule.java プロジェクト: jmulet/anuncis-mod
  /** Creates new form AnuncisModule */
  public AnuncisModule() {
    this.moduleDescription = "Anuncis";
    this.moduleDisplayName = "Anuncis";
    this.moduleName = "anuncis";
    this.multipleInstance = false;
    initComponents();
    jLinkButton1.setIcon(
        new ImageIcon(AnuncisModule.class.getResource("/org/iesapp/framework/icons/down.gif")));

    ButtonGroup buttonGroup2 = new ButtonGroup();
    buttonGroup2.add(jRadioButtonMenuItem1);
    buttonGroup2.add(jRadioButtonMenuItem2);

    buttonNouAnunci = new JButton();
    buttonNouAnunci.setToolTipText("Nou anunci");
    buttonNouAnunci.setName("nouanunci");
    buttonNouAnunci.setIcon(
        new ImageIcon(
            AnuncisModule.class.getResource("/org/iesapp/modules/anuncis/icons/insert.gif")));

    buttonNouAnunci.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            ShefEditor dlg = new ShefEditor(javar.JRDialog.getActiveFrame(), true, cfg);
            AnunciBean ba = new AnunciBean();
            ba.setAuthor(cfg.getCoreCfg().getUserInfo().getName());
            dlg.setBean(ba);

            screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            dlg.setSize((int) (screenSize.width * 0.8), (int) (screenSize.height * 0.9));
            dlg.setLocationRelativeTo(null);
            dlg.setVisible(true);
            fillList();
          }
        });

    buttonConfigure = new JButton();
    buttonConfigure.setToolTipText("Preferències");
    buttonConfigure.setName("configure");
    buttonConfigure.setIcon(
        new ImageIcon(getClass().getResource("/org/iesapp/modules/anuncis/icons/configIcon.gif")));
    buttonConfigure.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            Preferences dlg = new Preferences(AnuncisModule.this, true, cfg);
            dlg.setLocationRelativeTo(null);
            dlg.setVisible(true);
          }
        });
  }
コード例 #27
0
ファイル: PlotModelComponent.java プロジェクト: ethanrd/IDV
  /**
   * Make the gui widget for setting the station model
   *
   * @return the widget
   */
  private JComponent makeStationModelWidget() {
    JButton editButton = GuiUtils.getImageButton("/ucar/unidata/idv/images/edit.gif", getClass());
    editButton.setToolTipText("Show the plot model editor");
    editButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {}
        });

    label = new JLabel(" ");
    changeButton = GuiUtils.getImageButton("/auxdata/ui/icons/DownDown.gif", getClass());
    changeButton.setToolTipText("Click to change plot model");
    changeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            StationModelManager smm = idv.getStationModelManager();
            ObjectListener listener =
                new ObjectListener(null) {
                  public void actionPerformed(ActionEvent ae) {
                    Misc.run(
                        new Runnable() {
                          public void run() {
                            idv.showWaitCursor();
                            try {
                              plotModel = (StationModel) theObject;
                              if (plotModel != null) {
                                label.setText(plotModel.getDisplayName());
                              }
                              method.invoke(plotModelListener, new Object[] {plotModel});
                            } catch (Exception exc) {
                              idv.logException("Changing plot model", exc);
                            }
                            idv.showNormalCursor();
                          }
                        });
                  }
                };

            List items =
                StationModelCanvas.makeStationModelMenuItems(smm.getStationModels(), listener, smm);
            items.add(0, GuiUtils.MENU_SEPARATOR);
            if (addNone) {
              items.add(0, GuiUtils.makeMenuItem("None", PlotModelComponent.this, "setNone"));
            }
            items.add(0, GuiUtils.makeMenuItem("Edit", PlotModelComponent.this, "editPlotModel"));
            JPopupMenu popup = GuiUtils.makePopupMenu(items);
            popup.show(
                changeButton, changeButton.getSize().width / 2, changeButton.getSize().height);
          }
        });

    return GuiUtils.centerRight(label, GuiUtils.inset(changeButton, new Insets(0, 4, 0, 0)));
  }
コード例 #28
0
ファイル: JPicDialog.java プロジェクト: esprayer/EMPPlatform
  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);
  }
コード例 #29
0
ファイル: FsmPanel.java プロジェクト: JanUlrich/HamsterKI
  /** kreiert das Menü oben */
  private JToolBar createMenu() {
    JToolBar toolbar = new JToolBar();
    toolbar.setOrientation(SwingConstants.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setMargin(new Insets(2, 35, 2, 0));
    toolbar.setBackground(new Color(219, 255, 179));

    zoomIn = FsmUtils.createButton(zoomInImg);
    zoomIn.setToolTipText("Vergr��ern");
    zoomIn.addMouseListener(new ZoomInHandler(this));

    zoomOut = FsmUtils.createButton(zoomOutImg);
    zoomOut.setToolTipText("Verkleinern");
    zoomOut.addMouseListener(new ZoomOutHandler(this));

    layout = FsmUtils.createButton(layoutImg);
    layout.setToolTipText("Automatisch layouten");
    layout.addMouseListener(new LayoutHandler(this));

    deterministic = new JRadioButton("deterministisch");
    deterministic.setToolTipText("Der endliche Automat wird deterministisch");
    deterministic.setBackground(new Color(219, 255, 179));
    deterministic.addMouseListener(new TypeOfFsmHandler(this, false));

    nondeterministic = new JRadioButton("nichtdeterministisch");
    nondeterministic.setToolTipText("Der endliche Automat wird nichtdeterministisch");
    nondeterministic.setBackground(new Color(219, 255, 179));
    nondeterministic.addMouseListener(new TypeOfFsmHandler(this, true));

    ButtonGroup group = new ButtonGroup();
    group.add(deterministic);
    group.add(nondeterministic);
    if (this.getFsmProgram().isNondeterministic()) {
      group.setSelected(nondeterministic.getModel(), true);
    } else {
      group.setSelected(deterministic.getModel(), true);
    }

    toolbar.add(zoomIn);
    toolbar.add(Box.createHorizontalStrut(2));
    toolbar.add(zoomOut);
    toolbar.add(Box.createHorizontalStrut(2));
    toolbar.add(Box.createHorizontalStrut(2));
    toolbar.add(layout);
    toolbar.addSeparator();
    toolbar.add(deterministic);
    toolbar.add(nondeterministic);

    return toolbar;
  }
コード例 #30
0
  private void setupToolBar() // {{{
      {
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setName("listToolbar"); // NOI18N
    toolbar.setPreferredSize(new java.awt.Dimension(100, 18));

    btnPrev.setIcon(resourceMap.getIcon("btnPrev.icon")); // NOI18N
    btnPrev.setText(resourceMap.getString("btnPrev.text")); // NOI18N
    btnPrev.setToolTipText(resourceMap.getString("btnPrev.toolTipText")); // NOI18N
    btnPrev.setFocusable(false);
    btnPrev.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnPrev.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnPrev.setName("btnPrev"); // NOI18N
    btnPrev.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    toolbar.add(btnPrev);

    jSeparator3.setMaximumSize(new java.awt.Dimension(1000, 10));
    jSeparator3.setName("jSeparator3"); // NOI18N
    toolbar.add(jSeparator3);

    btnAddList.setAction(actionMap.get("addNewList"));
    btnAddList.setText(resourceMap.getString("btnAddList.text"));
    btnAddList.setIcon(resourceMap.getIcon("btnAddList.icon"));
    btnAddList.setToolTipText(resourceMap.getString("btnAddList.toolTipText"));
    btnAddList.setMargin(new java.awt.Insets(2, 2, 2, 2));
    toolbar.add(btnAddList);

    btnDeleteList.setAction(actionMap.get("deleteList"));
    btnDeleteList.setText(resourceMap.getString("btnDeleteList.text"));
    btnDeleteList.setIcon(resourceMap.getIcon("btnDeleteList.icon"));
    btnDeleteList.setToolTipText(resourceMap.getString("btnDeleteList.toolTipText"));
    btnDeleteList.setMargin(new java.awt.Insets(2, 2, 2, 2));
    toolbar.add(btnDeleteList);

    separatorRight.setMaximumSize(new java.awt.Dimension(1000, 10));
    separatorRight.setName("separatorRight"); // NOI18N
    toolbar.add(separatorRight);

    btnNext.setIcon(resourceMap.getIcon("btnNext.icon")); // NOI18N
    btnNext.setToolTipText(resourceMap.getString("btnNext.toolTipText")); // NOI18N
    btnNext.setFocusable(false);
    btnNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnNext.setLabel(resourceMap.getString("btnNext.label")); // NOI18N
    btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnNext.setName("btnNext"); // NOI18N
    btnNext.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    toolbar.add(btnNext);
  } // }}}