Beispiel #1
0
  public SidePaneComponent(SidePaneManager manager, Icon icon, String title) {
    super(title);
    this.manager = manager;

    this.add(new JLabel(icon));

    setTitleForeground(new Color(79, 95, 143));
    setBorder(BorderFactory.createEmptyBorder());

    close.setMargin(new Insets(0, 0, 0, 0));
    close.setBorder(null);
    close.addActionListener(e -> hideAway());

    JButton up = new JButton(IconTheme.JabRefIcon.UP.getSmallIcon());
    up.setMargin(new Insets(0, 0, 0, 0));
    up.setBorder(null);
    up.addActionListener(e -> moveUp());

    JButton down = new JButton(IconTheme.JabRefIcon.DOWN.getSmallIcon());
    down.setMargin(new Insets(0, 0, 0, 0));
    down.setBorder(null);
    down.addActionListener(e -> moveDown());

    JToolBar tlb = new OSXCompatibleToolbar();
    tlb.add(up);
    tlb.add(down);
    tlb.add(close);
    tlb.setOpaque(false);
    tlb.setFloatable(false);
    this.getUI().getTitleBar().add(tlb);
    setTitlePainter(new MattePainter(Color.lightGray));
  }
Beispiel #2
0
  @Override
  public void run() {
    ArrayList<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>();

    buttonOpen = new JButton("Open file");
    buttonOpen.addActionListener(new openFile());
    openFileL = new JLabel("Open file...");

    frame = new JFrame("SRPP PROJECT");
    frame.setPreferredSize(new Dimension(510, 590));
    frame.setResizable(false);

    JToolBar bar1 = new JToolBar();
    bar1.setFloatable(false);
    bar1.add(buttonOpen);
    bar1.add(openFileL);
    bar1.setMargin(new Insets(5, 5, 5, 5));
    frame.add(bar1, BorderLayout.NORTH);

    drawPanel = new DrawPanel(cities, paths, magazine);
    frame.add(drawPanel, BorderLayout.CENTER);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
 /** Builds and lays out the UI. */
 private void buildGUI() {
   setBackground(UIUtilities.BACKGROUND_COLOR);
   setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
   if (selectable) add(checkbox);
   add(label);
   JToolBar bar = new JToolBar();
   bar.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.setFloatable(false);
   bar.setRollover(true);
   bar.setBorder(null);
   bar.setOpaque(true);
   boolean b = setControlsEnabled(data != null);
   int count = 0;
   if (editButton != null) count++;
   if (unlinkButton != null) count++;
   if (downloadButton != null) count++;
   if (infoButton != null) count++;
   if (openButton != null) count++;
   if (count > 0 && data != null) {
     menuButton.setEnabled(true);
     if (model.isAcrossGroups()) menuButton.setEnabled(false);
     bar.add(menuButton);
     if (!b) bar.add(Box.createHorizontalStrut(8));
     add(bar);
   }
 }
 public TestFrame() {
   super("Home Plan Component Test");
   this.home = new Home();
   this.home.getCompass().setVisible(false);
   UserPreferences preferences = new DefaultUserPreferences();
   ViewFactory viewFactory = new SwingViewFactory();
   this.homeController = new HomeController(home, preferences, viewFactory);
   JComponent homeView = (JComponent) this.homeController.getView();
   ActionMap actions = homeView.getActionMap();
   // Create buttons from HomePane actions map
   this.selectButton = new JToggleButton(actions.get(HomePane.ActionType.SELECT));
   this.createWallsButton = new JToggleButton(actions.get(HomePane.ActionType.CREATE_WALLS));
   this.createDimensionsButton =
       new JToggleButton(actions.get(HomePane.ActionType.CREATE_DIMENSION_LINES));
   ButtonGroup group = new ButtonGroup();
   group.add(this.selectButton);
   group.add(this.createWallsButton);
   group.add(this.createDimensionsButton);
   this.addButton = new JButton(actions.get(HomePane.ActionType.ADD_HOME_FURNITURE));
   this.undoButton = new JButton(actions.get(HomePane.ActionType.UNDO));
   this.redoButton = new JButton(actions.get(HomePane.ActionType.REDO));
   // Put them it a tool bar
   JToolBar toolBar = new JToolBar();
   toolBar.add(this.selectButton);
   toolBar.add(this.createWallsButton);
   toolBar.add(this.addButton);
   toolBar.add(this.undoButton);
   toolBar.add(this.redoButton);
   // Display the tool bar and main view in this pane
   add(toolBar, BorderLayout.NORTH);
   add(homeView, BorderLayout.CENTER);
   pack();
 }
  public ScrolledTextPane() {
    mainPanel = new JPanel(new BorderLayout());
    textPane = new JTextPane();
    scrollPane =
        new JScrollPane(
            textPane,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    setPreferredScrollableSize(new Dimension(350, 550));
    mainPanel.add(BorderLayout.CENTER, scrollPane);

    southToolBar = new JToolBar();
    mainPanel.add(BorderLayout.SOUTH, southToolBar);

    JButton clearButton = new JButton("clear");
    JButton copyToClipboardButton = new JButton("copy");
    southToolBar.add(clearButton);
    southToolBar.add(copyToClipboardButton);

    clearButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearText();
          }
        });
    copyToClipboardButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copyToClipboard();
          }
        });
  }
  /** Construit la barre de menu ainsi que la barre d'outils de l'application. */
  protected void contruireBarreMenusEtOutils() {
    final JMenuBar barreMenu = new JMenuBar();
    final JToolBar barreOutils = new JToolBar();
    final JMenu menu = new JMenu("Grenouilloland");
    final JSeparator separateur = new JSeparator();
    final ActionAbstraite actionAPropos = new ActionAPropos(this);
    final ActionAbstraite actionNouveau = new ActionNouveau(this);
    final ActionAbstraite actionLancer = new ActionLancer(this);

    menu.setMnemonic('g');
    // Ajout des différentes actions du menu
    menu.add(actionNouveau);
    menu.add(actionLancer);
    menu.add(actionAPropos);
    menu.add(separateur);
    menu.add(actionQuitter);
    // On ajoute le menu à la barre de menu
    barreMenu.add(menu);
    setJMenuBar(barreMenu);

    // Ajout des différentes actions de la barre d'outils
    barreOutils.add(actionNouveau);
    barreOutils.add(actionLancer);
    barreOutils.add(actionAPropos);
    barreOutils.addSeparator();
    barreOutils.add(actionQuitter);

    add(barreOutils, BorderLayout.NORTH);
  }
  public void initToolBar() {
    tb = new JToolBar();

    tb.setFloatable(false);

    usezoombt = new JToggleButton("-1", XmippResource.getIcon("zoom.png"));
    usezoombt.setToolTipText("Keep zoom");
    usezoombt.setFocusable(false);
    usezoombt.setSelected(true);
    usezoombt.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            if (!usezoombt.isSelected()) getParticlePicker().setZoom(-1);
          }
        });
    tb.add(usezoombt);
    initShapePane();
    tb.add(shapepn);
    initSizePane();
    tb.add(sizepn);
    if (!(this instanceof ExtractPickerJFrame)) {
      initColorPane(getParticlePicker().getColor());
      tb.add(colorpn);
      eraserbt = new JToggleButton(bundle.getString("eraser"), XmippResource.getIcon("eraser.png"));
      tb.add(eraserbt);
    }
  }
  protected void addStyleButtons() {
    borderBtn =
        new JButton(STLConstants.K0530_SHOW_BORDER.getValue(), UIImages.HIDE_BORDER.getImageIcon());
    borderBtn.setOpaque(false);
    borderBtn.setFocusable(false);
    borderBtn.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            boolean isSelected = borderBtn.getIcon() != UIImages.SHOW_BORDER.getImageIcon();
            setShowBorder(isSelected);
            if (listener != null) {
              listener.onShowBorder(isSelected);
            }
          }
        });
    toolBar.add(borderBtn);

    alternationBtn =
        new JButton(STLConstants.K0533_UNI_ROWS.getValue(), UIImages.UNI_ROWS.getImageIcon());
    alternationBtn.setOpaque(false);
    alternationBtn.setFocusable(false);
    alternationBtn.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            boolean isSelected = alternationBtn.getIcon() != UIImages.ALT_ROWS.getImageIcon();
            setShowAlternation(isSelected);
            if (listener != null) {
              listener.onShowAlternation(isSelected);
            }
          }
        });
    toolBar.add(alternationBtn);
  }
Beispiel #9
0
  private JComponent createPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JToolBar bar = new JToolBar();
    bar.add(
        new AbstractAction("Force Rerouting") {
          public void actionPerformed(ActionEvent e) {
            connection.reroute();
            validate();
          }
        });
    bar.addSeparator();
    bar.add(
        new AbstractAction("Reset routing policy to always-route") {
          public void actionPerformed(ActionEvent e) {
            connection.setRoutingPolicy(ConnectionWidget.RoutingPolicy.ALWAYS_ROUTE);
            validate();
          }
        });
    panel.add(bar, BorderLayout.NORTH);

    panel.add(createView(), BorderLayout.CENTER);
    return panel;
  }
Beispiel #10
0
  private void init() {

    this.setLayout(new BorderLayout());
    JToolBar toolBar = new JToolBar("Java 截图");

    // 保存按钮
    JButton saveButton = new JButton(new ImageIcon("images/save.gif"));
    saveButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              parent.saveImage();
            } catch (IOException e1) {
              e1.printStackTrace();
            }
          }
        });
    toolBar.add(saveButton);

    // 关闭按钮
    JButton closeButton = new JButton(new ImageIcon("images/close.gif"));
    closeButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
    toolBar.add(closeButton);

    this.add(toolBar, BorderLayout.NORTH);
  }
 private JToolBar createToolBar() {
   final JToolBar toolBar = new JToolBar();
   this.addPhenotypeButton =
       new JButton(
           new AbstractAction(
               null,
               new ImageIcon(
                   this.getClass().getResource("/org/phenoscape/view/images/list-add.png"))) {
             @Override
             public void actionPerformed(ActionEvent e) {
               addPhenotype();
             }
           });
   this.addPhenotypeButton.setToolTipText("Add Phenotype");
   toolBar.add(this.addPhenotypeButton);
   this.deletePhenotypeButton =
       new JButton(
           new AbstractAction(
               null,
               new ImageIcon(
                   this.getClass().getResource("/org/phenoscape/view/images/list-remove.png"))) {
             @Override
             public void actionPerformed(ActionEvent e) {
               deleteSelectedPhenotype();
             }
           });
   this.deletePhenotypeButton.setToolTipText("Delete Phenotype");
   toolBar.add(this.deletePhenotypeButton);
   toolBar.setFloatable(false);
   return toolBar;
 }
Beispiel #12
0
  /** Creates the main frame for <code>this</code> sample. */
  public CornerRadius() {
    super("Toolbar button corner radius");

    this.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar("");
    toolBar.add(new JLabel("Sample toolbar"));
    toolBar.add(new JSeparator(SwingConstants.VERTICAL));

    JToggleButton buttonDefault = new JToggleButton("radius default");
    buttonDefault.setSelected(true);
    toolBar.add(buttonDefault);

    JToggleButton button1 = new JToggleButton("radius 5");
    // set corner radius to 5 pixels
    button1.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, Float.valueOf(5.0f));
    button1.setSelected(true);
    toolBar.add(button1);

    JToggleButton button2 = new JToggleButton("radius 0");
    // set corner radius to 0 pixels (perfect rectangle)
    button2.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, Float.valueOf(0.0f));
    button2.setSelected(true);
    toolBar.add(button2);

    this.add(toolBar, BorderLayout.NORTH);

    this.setSize(400, 200);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
 /** 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);
 }
Beispiel #14
0
  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;
  }
 private JToolBar getToolBar() {
   JToolBar barraBotones = new JToolBar();
   barraBotones.add(new JButton("1"));
   barraBotones.add(new JButton("2"));
   barraBotones.add(new JButton("3"));
   barraBotones.add(new JButton("4"));
   barraBotones.add(new JButton("5"));
   return barraBotones;
 }
Beispiel #16
0
  public UserGUI() {
    super("접속을 환영합니다^^");
    this.setEnabled(false);
    // this.login = login;

    new LoginGUI(this);

    jp.setDividerLocation(345);
    jp2.setDividerLocation(345);

    p4.setMinimumSize(new Dimension(400, 300));
    // 툴바 컴포넌트에 버튼 삽입
    tb1.add(btn1);
    tb1.add(btn2);
    tb1.add(btn3);
    tb2.add(btn4);
    tb2.add(btn5);
    tb3.add(btn7);
    tb3.add(btn8);

    p2.setLayout(new BorderLayout());
    p2.add(tb2, "North"); // 툴바2를 패널2에 삽입
    p2.add(jp, "Center"); // 그래프가 들어갈 패널 jp을 패널2에 넣음

    p3.setLayout(new BorderLayout());
    p3.add(tb3, "North");
    p3.add(jp2, "Center");

    // 탭 컴포넌트에 패널1,2,3을 넣음
    tp.add(p2, "체중변화");
    tp.add(p3, "식단관리");
    tp.add(p1, "개인정보변경");

    p8.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p8.add(la);
    p8.add(btn6);

    add(p8, "North");
    add(tp, "Center");

    // add(p8,"East");

    setSize(800, 700); // 전체 창 크기

    // 창을 화면 가운데(x,y좌표에) 띄우겠다는 메소드
    int x = (Toolkit.getDefaultToolkit().getScreenSize().width - getSize().width) / 2;
    int y = (Toolkit.getDefaultToolkit().getScreenSize().height - getSize().height) / 2;
    setLocation(x, y);

    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    btn6.addActionListener(this);
    btn4.addActionListener(this);
    btn8.addActionListener(this);
  }
  public AttributeEditorDialog(JFrame owner, Operator exampleSource) {
    super(owner, "attribute_editor", true);

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(this);

    DataControl control = new DataControl(0, 0, "Example", "Attribute", false);
    attributeEditor = new AttributeEditor(exampleSource, control);
    control.addViewChangeListener(attributeEditor);
    getContentPane().add(control, BorderLayout.WEST);
    getContentPane().add(new ExtendedJScrollPane(attributeEditor), BorderLayout.CENTER);
    control.update();

    // initialize actions
    initActions();

    // menu bar
    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new ResourceMenu("attribute_editor_file");
    fileMenu.add(OPEN_ATTRIBUTE_FILE_ACTION);
    fileMenu.add(SAVE_ATTRIBUTE_FILE_ACTION);
    fileMenu.add(LOAD_DATA_ACTION);
    fileMenu.add(SAVE_DATA_ACTION);
    fileMenu.add(LOAD_SERIES_DATA_ACTION);
    fileMenu.addSeparator();
    fileMenu.add(CLOSE_ACTION);
    menuBar.add(fileMenu);

    JMenu tableMenu = new ResourceMenu("attribute_editor_table");
    tableMenu.add(attributeEditor.GUESS_TYPE_ACTION);
    tableMenu.add(attributeEditor.GUESS_ALL_TYPES_ACTION);
    tableMenu.add(attributeEditor.REMOVE_COLUMN_ACTION);
    tableMenu.add(attributeEditor.REMOVE_ROW_ACTION);
    tableMenu.add(attributeEditor.USE_ROW_AS_NAMES_ACTION);
    tableMenu.add(CLEAR_ACTION);
    menuBar.add(tableMenu);

    setJMenuBar(menuBar);

    // tool bar
    JToolBar toolBar = new ExtendedJToolBar();
    toolBar.add(OPEN_ATTRIBUTE_FILE_ACTION);
    toolBar.add(SAVE_ATTRIBUTE_FILE_ACTION);
    toolBar.add(LOAD_DATA_ACTION);
    toolBar.add(SAVE_DATA_ACTION);
    toolBar.addSeparator();
    toolBar.add(CLEAR_ACTION);
    getContentPane().add(toolBar, BorderLayout.NORTH);

    setSize(
        (int) Math.max(600, owner.getWidth() * 2.0d / 3.0d),
        (int) Math.max(400, owner.getHeight() * 2.0d / 3.0d));

    setLocationRelativeTo(owner);
  }
Beispiel #18
0
 /**
  * This method initializes jToolBar
  *
  * @return javax.swing.JToolBar
  */
 private JToolBar getJToolBar() {
   if (jToolBar == null) {
     jToolBar = new JToolBar();
     jToolBar.setFloatable(false);
     jToolBar.add(getJToggleButton());
     jToolBar.add(getJButton1());
     jToolBar.add(getJButton2());
   }
   return jToolBar;
 }
Beispiel #19
0
 /**
  * This method initializes jToolBar
  *
  * @return javax.swing.JToolBar
  */
 JToolBar getJToolBar() {
   if (jToolBar == null) {
     jToolBar = new JToolBar();
     jToolBar.add(getPlayButton());
     jToolBar.add(getStepButton());
     jToolBar.add(getPauseButton());
     jToolBar.add(getStopButton());
   }
   return jToolBar;
 }
Beispiel #20
0
 /** Creates a tool bar for the rule tree. */
 @Override
 protected JToolBar createListToolBar() {
   int separation = 7;
   JToolBar result = super.createListToolBar(separation);
   result.add(getActions().getShiftPriorityAction(true));
   result.add(getActions().getShiftPriorityAction(false));
   result.addSeparator(new Dimension(separation, 0));
   result.add(getCollapseAllButton());
   return result;
 }
  /**
   * The main program for the MiddlemanFrame class
   *
   * @todo describe the command line arguments
   * @todo-javadoc Write javadocs for method parameter
   * @todo-javadoc Write javadocs for method parameter
   * @todo-javadoc Write javadocs for method parameter
   * @param middlegen Describe what the parameter does
   * @param title Describe what the parameter does
   */
  public JMiddlegenFrame(Middlegen middlegen, String title) {
    super(title);
    _middlegen = middlegen;
    setKuststoffLF();

    // make panel with label header and tabs in center.
    JLabel header = new JLabel("", JLabel.CENTER);
    JSettingsTabPane settingsTabs = new JSettingsTabPane(middlegen.getPlugins());
    JPanel headerTabs = new JPanel(new BorderLayout());

    headerTabs.add(header, BorderLayout.NORTH);
    // headerTabs.add(settingsTabs, BorderLayout.CENTER);
    JToolBar pluginToolBar = new JToolBar();
    pluginToolBar.add(settingsTabs);
    headerTabs.add(pluginToolBar, BorderLayout.CENTER);

    _databasePanel = new JDatabasePanel(settingsTabs, header);

    JScrollPane scroll = new JScrollPane(_databasePanel);
    _split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scroll, headerTabs);
    _split.setDividerLocation(0.5);
    getContentPane().add(_split, BorderLayout.CENTER);

    JToolBar toolBar = new JToolBar();
    toolBar.add(_generateAction);
    toolBar.addSeparator();
    toolBar.add(new JLabel("CTRL-Click relations to modify their cardinality"));
    toolBar.addSeparator();
    toolBar.add(new JLabel("SHIFT-Click relations to modify their directionality"));
    getContentPane().add(toolBar, BorderLayout.NORTH);

    ImageIcon icon = new ImageIcon(getClass().getResource("m.gif"));
    setIconImage(icon.getImage());

    // dispose Frame on closing, so VM will exit when Ant Task has finished
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    // I have a dodgy feeling that a Mac would try to exit the VM when the
    // window closes. Try to uncomment this line on a Mac.
    // System.setSecurityManager(new NoExitSecurityManager());

    addWindowListener(
        new WindowAdapter() {

          public void windowClosing(WindowEvent evt) {
            // Tell the halted Ant task to resume.
            synchronized (MiddlegenTask.getLock()) {
              // Update positions of tables
              _databasePanel.setPrefs();
              // Let the ant task to continue
              MiddlegenTask.getLock().notify();
            }
          }
        });
  }
 protected JToolBar createToolbar() {
   JToolBar toolbar = new JToolBar();
   toolbar.setFloatable(false);
   toolbar.setBorderPainted(false);
   toolbar.add(createButton("images/cross_add.gif", null, ADD));
   toolbar.add(createButton("images/cross_delete.gif", null, REMOVE));
   toolbar.add(createButton("images/arrow_up.gif", null, UP));
   toolbar.add(createButton("images/arrow_down.gif", null, DOWN));
   setButtonEnabled(ADD, true);
   return toolbar;
 }
Beispiel #23
0
  public JToolBar createToolBar() {
    JToolBar toolbar = super.createToolBar();
    // Hide
    hide =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            graph.getGraphLayoutCache().hideCells(graph.getSelectionCells(), true);
          }
        };
    URL url = getClass().getClassLoader().getResource("com/jgraph/example/adapter/image/hide.gif");
    hide.putValue(Action.SMALL_ICON, new ImageIcon(url));
    hide.setEnabled(false);
    toolbar.addSeparator();
    toolbar.add(hide);
    toolbar.addSeparator();

    // Collapse
    collapse =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            graph.getGraphLayoutCache().collapse(graph.getSelectionCells());
          }
        };
    url = getClass().getClassLoader().getResource("com/jgraph/example/adapter/image/collapse.gif");
    collapse.putValue(Action.SMALL_ICON, new ImageIcon(url));
    collapse.setEnabled(false);
    toolbar.add(collapse);

    // Expand
    expand =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            graph.getGraphLayoutCache().expand(graph.getSelectionCells());
          }
        };
    url = getClass().getClassLoader().getResource("com/jgraph/example/adapter/image/expand.gif");
    expand.putValue(Action.SMALL_ICON, new ImageIcon(url));
    expand.setEnabled(false);
    toolbar.add(expand);

    // ExpandAll
    expandAll =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            graph.getGraphLayoutCache().expand(graph.getDescendants(graph.getSelectionCells()));
          }
        };
    url = getClass().getClassLoader().getResource("com/jgraph/example/adapter/image/expandAll.gif");
    expandAll.putValue(Action.SMALL_ICON, new ImageIcon(url));
    expandAll.setEnabled(false);
    toolbar.add(expandAll);

    return toolbar;
  }
Beispiel #24
0
 // arranges the tool bar
 protected void arrangeToolBar() {
   toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
   toolBar.add(loadButton);
   toolBar.add(saveButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(singleStepButton);
   toolBar.add(ffwdButton);
   toolBar.add(stopButton);
   toolBar.add(rewindButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(fullTranslationButton);
 }
  // -------------------------------------------------------------------------------------
  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
 /**
  * Creates a tool bar and adds the passed buttons to it.
  *
  * @param addButton The button to add.
  * @param removeButton The button to add.
  * @return See above.
  */
 private JToolBar createBar(JButton addButton, JButton removeButton) {
   JToolBar bar = new JToolBar();
   bar.setFloatable(false);
   bar.setBorder(null);
   bar.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.add(addButton);
   if (removeButton != null) {
     // bar.add(Box.createHorizontalStrut(2));
     bar.add(removeButton);
   }
   return bar;
 }
Beispiel #27
0
  public IvusFrame(World world) {
    OrbitView view = (world != null) ? new OrbitView(world) : new OrbitView();
    view.setAxesOrientation(AxesOrientation.XRIGHT_YOUT_ZDOWN);
    ViewCanvas canvas = new ViewCanvas(view);
    canvas.setView(view);

    ModeManager mm = new ModeManager();
    mm.add(canvas);
    OrbitViewMode ovm = new OrbitViewMode(mm);
    SelectDragMode sdm = new SelectDragMode(mm);

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    Action exitAction =
        new AbstractAction("Exit") {
          private static final long serialVersionUID = 1L;

          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        };
    JMenuItem exitItem = fileMenu.add(exitAction);
    exitItem.setMnemonic('x');

    JMenu modeMenu = new JMenu("Mode");
    modeMenu.setMnemonic('M');
    JMenuItem ovmItem = new ModeMenuItem(ovm);
    modeMenu.add(ovmItem);
    JMenuItem sdmItem = new ModeMenuItem(sdm);
    modeMenu.add(sdmItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(modeMenu);

    JToolBar toolBar = new JToolBar(SwingConstants.VERTICAL);
    toolBar.setRollover(true);
    JToggleButton ovmButton = new ModeToggleButton(ovm);
    toolBar.add(ovmButton);
    JToggleButton sdmButton = new ModeToggleButton(sdm);
    toolBar.add(sdmButton);

    ovm.setActive(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(new Dimension(SIZE, SIZE));
    this.add(canvas, BorderLayout.CENTER);
    this.add(toolBar, BorderLayout.WEST);
    this.setJMenuBar(menuBar);
  }
 @Override
 public JToolBar buildAnnotationlToolBar() {
   System.out.println("Annotationl Toolbar is removed");
   JToolBar annotationToolBar = new JToolBar();
   // annotationToolBar.add(statusButtonGroup);
   annotationToolBar.add(voidButton);
   annotationToolBar.add(skipButton);
   annotationToolBar.add(selectButton);
   annotationToolBar.add(seqText);
   annotationToolBar.add(submitButton);
   return annotationToolBar;
 }
Beispiel #29
0
 /**
  * Initializes the toolbar of the notepad.
  *
  * @param actions which are added to the toolbar of this frame.
  */
 private void initToolBar(Map<String, NotepadAction> actions) {
   JToolBar toolbar = new JToolBar();
   toolbar.add(actions.get("openNew"));
   toolbar.add(actions.get("openExisting"));
   toolbar.add(actions.get("close"));
   toolbar.add(actions.get("save"));
   toolbar.add(actions.get("saveAs"));
   toolbar.add(actions.get("copy"));
   toolbar.add(actions.get("paste"));
   toolbar.add(actions.get("cut"));
   toolbar.add(actions.get("showStatz"));
   toolbar.add(actions.get("exit"));
   getContentPane().add(toolbar, BorderLayout.NORTH);
 }
  // Create a simple JToolBar with some buttons.
  protected JToolBar createToolBar() {
    JToolBar bar = new JToolBar();

    // Add simple actions for opening & saving.
    bar.add(getOpenAction()).setText("");
    bar.add(getSaveAction()).setText("");
    bar.addSeparator();

    // Add cut/copy/paste buttons.
    bar.add(textComp.getActionMap().get(DefaultEditorKit.cutAction)).setText("");
    bar.add(textComp.getActionMap().get(DefaultEditorKit.copyAction)).setText("");
    bar.add(textComp.getActionMap().get(DefaultEditorKit.pasteAction)).setText("");
    return bar;
  }