/**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
Exemple #2
0
  /** @param frameName title name for frame */
  public ShowSavedResults(String frameName) {
    super(frameName);
    aboutRes =
        new JTextArea(
            "Select a result set from"
                + "\nthose listed and details"
                + "\nof that analysis will be"
                + "\nshown here. Then you can"
                + "\neither delete or view those"
                + "\nresults using the buttons below.");
    aboutScroll = new JScrollPane(aboutRes);
    ss = new JScrollPane(sp);
    ss.getViewport().setBackground(Color.white);

    //  resMenu.setLayout(new FlowLayout(FlowLayout.LEFT,10,1));
    ClassLoader cl = getClass().getClassLoader();
    rfii = new ImageIcon(cl.getResource("images/Refresh_button.gif"));

    // results status
    resButtonStatus = new JPanel(new BorderLayout());
    Border loweredbevel = BorderFactory.createLoweredBevelBorder();
    Border raisedbevel = BorderFactory.createRaisedBevelBorder();
    Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);
    statusField = new JTextField();
    statusField.setBorder(compound);
    statusField.setEditable(false);
  }
  public CreInvChecker(Component parent) {
    typeButtons = new JCheckBox[CHECKTYPES.length];
    JPanel boxPanel = new JPanel(new GridLayout(0, 1));
    for (int i = 0; i < typeButtons.length; i++) {
      typeButtons[i] = new JCheckBox(CHECKTYPES[i], true);
      boxPanel.add(typeButtons[i]);
    }
    bstart.setMnemonic('s');
    bcancel.setMnemonic('c');
    bstart.addActionListener(this);
    bcancel.addActionListener(this);
    selectframe.getRootPane().setDefaultButton(bstart);
    selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage());
    boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:"));

    JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bpanel.add(bstart);
    bpanel.add(bcancel);

    JPanel mainpanel = new JPanel(new BorderLayout());
    mainpanel.add(boxPanel, BorderLayout.CENTER);
    mainpanel.add(bpanel, BorderLayout.SOUTH);
    mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

    JPanel pane = (JPanel) selectframe.getContentPane();
    pane.setLayout(new BorderLayout());
    pane.add(mainpanel, BorderLayout.CENTER);

    selectframe.pack();
    Center.center(selectframe, parent.getBounds());
    selectframe.setVisible(true);
  }
    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);
    }
Exemple #5
0
 /*
  *Creates the JTextField for the GUI.
  */
 private JTextField inputField() {
   inputField = new JTextField();
   Border inputBorder = BorderFactory.createEtchedBorder();
   inputBorder = BorderFactory.createTitledBorder(inputBorder, "Please type your words here:");
   inputField.setBorder(inputBorder);
   inputField.addActionListener(new ActionListenerField());
   return inputField;
 }
 void updateColor() {
   if (gNode.isInitial()) {
     setBackground(Color.yellow);
     setBorder(BorderFactory.createLineBorder(Color.yellow, 1));
     //  two pixels wide
   } else {
     setBackground(Color.white);
     setBorder(BorderFactory.createLineBorder(Color.black, 1));
   }
 }
Exemple #7
0
    public AppFrame() {
      // Create the WorldWindow.
      this.wwjPanel = new ApplicationTemplate.AppPanel(this.canvasSize, true);
      this.wwjPanel.setPreferredSize(canvasSize);

      ApplicationTemplate.insertBeforePlacenames(this.wwjPanel.getWwd(), layer);

      JPanel shapesPanel = makeShapeSelectionPanel();
      shapesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      JPanel attrsPanel = makeAttributesPanel();
      attrsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      // Put the pieces together.
      JPanel controlPanel = new JPanel(new BorderLayout());
      controlPanel.add(shapesPanel, BorderLayout.CENTER);
      JPanel p = new JPanel(new BorderLayout(6, 6));
      p.add(attrsPanel, BorderLayout.CENTER);
      controlPanel.add(p, BorderLayout.SOUTH);

      this.getContentPane().add(wwjPanel, BorderLayout.CENTER);
      this.getContentPane().add(controlPanel, BorderLayout.WEST);
      this.pack();

      // Center the application on the screen.
      Dimension prefSize = this.getPreferredSize();
      Dimension parentSize;
      java.awt.Point parentLocation = new java.awt.Point(0, 0);
      parentSize = Toolkit.getDefaultToolkit().getScreenSize();
      int x = parentLocation.x + (parentSize.width - prefSize.width) / 2;
      int y = parentLocation.y + (parentSize.height - prefSize.height) / 2;
      this.setLocation(x, y);
      this.setResizable(true);

      wwjPanel
          .getWwd()
          .addRenderingListener(
              new RenderingListener() {
                public void stageChanged(RenderingEvent event) {
                  if (!event.getStage().equals(RenderingEvent.BEFORE_BUFFER_SWAP)) return;

                  if (currentShape instanceof Polyline) {
                    Polyline p = (Polyline) currentShape;
                    String length = Double.toString(p.getLength());
                    textRenderer.beginRendering(wwjPanel.getWidth(), wwjPanel.getHeight());
                    textRenderer.draw(length, 100, 100);
                    textRenderer.endRendering();
                  }
                }
              });

      // Enable dragging and other selection responses
      this.setupSelection();
    }
Exemple #8
0
    /**
     * Constructor.
     *
     * @param title the title of the tab component
     * @param editor the editor of the tab (used to close the tab)
     */
    public TabComponent(final AbstractEditorPanel editor) {

      setLayout(new BorderLayout());
      setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
      setOpaque(false);

      // title
      title = new JLabel(editor.getTitle());
      title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
      add(title, BorderLayout.WEST);

      // close
      final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png"));
      close.setPreferredSize(new Dimension(16, 16));
      close.setUI(new BasicButtonUI());
      close.setBorderPainted(false);
      close.setOpaque(false);
      close.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
              removeEditor(editor, true);
            }
          });
      close.addMouseListener(
          new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent me) {}

            @Override
            public void mousePressed(MouseEvent me) {}

            @Override
            public void mouseReleased(MouseEvent me) {}

            @Override
            public void mouseEntered(MouseEvent me) {

              close.setBorderPainted(true);
            }

            @Override
            public void mouseExited(MouseEvent me) {

              close.setBorderPainted(false);
            }
          });
      add(close, BorderLayout.EAST);
    }
Exemple #9
0
  /**
   * Creates an instance of <tt>CallManager</tt>.
   *
   * @param mainFrame The main application window.
   */
  public CallManager(MainFrame mainFrame) {
    super(new BorderLayout());

    this.mainFrame = mainFrame;

    this.phoneNumberCombo = new CallComboBox(this);

    this.accountSelectorBox = new AccountSelectorBox(this);

    this.buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    this.comboPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5));

    this.init();
  }
  private MainPanel() {
    super(new BorderLayout());
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < 100; i++) {
      String s = i + LF;
      buf.append(s);
    }

    final JScrollPane scrollPane = new JScrollPane(new JTextArea(buf.toString()));
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    JSpinner spinner =
        new JSpinner(
            new SpinnerNumberModel(
                scrollPane.getVerticalScrollBar().getUnitIncrement(1), 1, 100000, 1));
    spinner.setEditor(new JSpinner.NumberEditor(spinner, "#####0"));
    spinner.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSpinner s = (JSpinner) e.getSource();
            scrollPane.getVerticalScrollBar().setUnitIncrement((Integer) s.getValue());
          }
        });
    Box box = Box.createHorizontalBox();
    box.add(new JLabel("Unit Increment:"));
    box.add(Box.createHorizontalStrut(2));
    box.add(spinner);
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(box, BorderLayout.NORTH);
    add(scrollPane);
    setPreferredSize(new Dimension(320, 240));
  }
 public MainPanel() {
   super(new BorderLayout());
   JEditorPane editor =
       new JEditorPane("text/html", String.format("<html><a href='%s'>%s</a>", MYSITE, MYSITE));
   editor.setOpaque(false);
   editor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
   editor.setEditable(false);
   editor.addHyperlinkListener(
       new HyperlinkListener() {
         @Override
         public void hyperlinkUpdate(HyperlinkEvent e) {
           if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED
               && Desktop.isDesktopSupported()) {
             try {
               Desktop.getDesktop().browse(new URI(MYSITE));
             } catch (IOException | URISyntaxException ex) {
               ex.printStackTrace();
             }
             textArea.setText(e.toString());
           }
         }
       });
   JPanel p = new JPanel();
   p.add(editor);
   p.setBorder(BorderFactory.createTitledBorder("Desktop.getDesktop().browse(URI)"));
   add(p, BorderLayout.NORTH);
   add(new JScrollPane(textArea));
   setPreferredSize(new Dimension(320, 240));
 }
 private OffsetPanel(Component comp) {
   this.setLayout(new BorderLayout(0, 0));
   TitledBorder tb = BorderFactory.createTitledBorder(b.getString("kOffsetBy"));
   if (JOAConstants.ISMAC) {
     // tb.setTitleFont(new Font("Helvetica", Font.PLAIN, 11));
   }
   this.setBorder(tb);
   JPanel controls = new JPanel();
   controls.setLayout(new GridLayout(3, 1, 5, 0));
   b1 = new JOAJRadioButton(b.getString("kSequence"));
   b2 = new JOAJRadioButton(b.getString("kDistance"), true);
   b3 = new JOAJRadioButton(b.getString("kTime"));
   controls.add(b2);
   controls.add(b1);
   controls.add(b3);
   controls.add(new JOAJLabel("       "));
   ButtonGroup bg = new ButtonGroup();
   bg.add(b1);
   bg.add(b2);
   bg.add(b3);
   this.add("Center", controls);
   b1.addItemListener((ItemListener) comp);
   b2.addItemListener((ItemListener) comp);
   b3.addItemListener((ItemListener) comp);
 }
  public DynamicTree() {
    super(new GridLayout(1, 0));
    rootNode = new JscTreeNode("Vitenfabrikken");
    treeModel = new DefaultTreeModel(rootNode);

    tree = new JTree(treeModel);
    tree.setEditable(false);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);
    tree.addTreeSelectionListener(this);

    JPanel content = new JPanel(new BorderLayout(0, 0));

    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setSize(500, 300);
    scrollPane.setBorder(BorderFactory.createTitledBorder("Maskiner"));
    content.add(scrollPane);
    // add(scrollPane);

    currentSelectionField = new JTextField("Valgt: NONE");
    // currentSelectionField.setSize(500, 15);
    currentSelectionField.setMaximumSize(new Dimension(500, 15));
    content.add(currentSelectionField, BorderLayout.SOUTH);
    // add(currentSelectionField);
    // content.setPreferredSize(new Dimension(500, 315));

    add(content);
    setSize(500, 315);
  }
 public ConverterPanel(CFrame F, ConvertibleValue CV) {
   super(new GridBagLayout()); // call to super must be first statement in constructor
   setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue));
   frame = F;
   cValue = CV;
   preferedSize = new Dimension(100, 40);
   setBackground(white);
 } // constructor
Exemple #15
0
 private JTabbedPane buildProblemsConsole() {
   // build the problems/console editor
   JTabbedPane tp = new JTabbedPane();
   ImageIcon consoleIcon = makeImageIcon("stock_print-layout-16.png");
   tp.addTab("Problems", addScrollers(problemsView));
   tp.addTab("Console", consoleIcon, addScrollers(consoleView));
   // empty border to give padding around tab pane
   tp.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
   return tp;
 }
Exemple #16
0
  protected void setUpSRSFrame(URL url, String search) throws IOException {
    if (BigPane.srsFrame == null) {
      BigPane.setUpSRSFrame((2 * desktop.getHeight()) / 3, desktop);
      Border loweredbevel = BorderFactory.createLoweredBevelBorder();
      Border raisedbevel = BorderFactory.createRaisedBevelBorder();
      Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);

      JTextField statusField = new JTextField();
      statusField.setBorder(compound);
      statusField.setEditable(false);
      BigPane.srsFrame.getContentPane().add(statusField, BorderLayout.SOUTH);
    }

    Annotation edPane = new Annotation(url);
    JScrollPane jsp = new JScrollPane(edPane);
    JTabbedPane jtab = (JTabbedPane) BigPane.srsFrame.getContentPane().getComponent(0);
    jtab.insertTab(search, null, jsp, null, 0);
    BigPane.srsFrame.setVisible(true);
  }
Exemple #17
0
  /** Creates an instance <tt>PropertiesEditorPanel</tt>. */
  public PropertiesEditorPanel() {
    super(new BorderLayout());

    /**
     * Instantiates the properties table and adds selection model and listener and adds a row sorter
     * to the table model
     */
    ResourceManagementService r = PropertiesEditorActivator.getResourceManagementService();
    String[] columnNames =
        new String[] {r.getI18NString("service.gui.NAME"), r.getI18NString("service.gui.VALUE")};

    propsTable = new JTable(new PropsTableModel(initTableModel(), columnNames));
    propsTable.setRowSorter(new TableRowSorter<TableModel>(propsTable.getModel()));
    propsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    PropsListSelectionListener selectionListener = new PropsListSelectionListener();

    propsTable.getSelectionModel().addListSelectionListener(selectionListener);
    propsTable.getColumnModel().getSelectionModel().addListSelectionListener(selectionListener);

    JScrollPane scrollPane = new JScrollPane(propsTable);
    SearchField searchField = new SearchField("", propsTable);

    buttonsPanel = new ButtonsPanel(propsTable, searchField);

    centerPanel = new TransparentPanel(new BorderLayout());
    centerPanel.add(scrollPane, BorderLayout.CENTER);
    centerPanel.add(buttonsPanel, BorderLayout.EAST);

    JLabel needRestart = new JLabel(r.getI18NString("plugin.propertieseditor.NEED_RESTART"));

    needRestart.setForeground(Color.RED);

    TransparentPanel searchPanel = new TransparentPanel(new BorderLayout(5, 0));

    searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
    searchPanel.add(searchField, BorderLayout.CENTER);

    setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    add(searchPanel, BorderLayout.NORTH);
    add(centerPanel, BorderLayout.CENTER);
    add(needRestart, BorderLayout.SOUTH);
  }
 ASDEditNode(ASDGrammarNode grammarNode, Container given) {
   super(" " + grammarNode.word() + " " + grammarNode.instance() + " ");
   gNode = grammarNode;
   context = given;
   addMouseListener((MouseListener) this);
   popupListener = new PopupListener(new EditNodeMenu(this));
   addMouseListener(popupListener);
   addChangeListener((ChangeListener) this);
   addMouseMotionListener((MouseMotionListener) this);
   if (grammarNode.isInitial()) {
     setBackground(Color.yellow);
     setBorder(BorderFactory.createLineBorder(Color.yellow, 1));
     //  two pixels wide
   } else {
     setBackground(Color.white);
     setBorder(BorderFactory.createLineBorder(Color.black, 1));
   }
   if (grammarNode.isFinal()) initializeRightLabel(grammarNode.phraseType());
 }
  /** Constructor. */
  public TilePatternsView() {
    super();

    tilePatternIcons = new ArrayList<TilePatternIcon>();

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // tileset properties
    // the tile pattern list
    // view of the current tile pattern

    // tileset properties
    tilesetPropertiesView = new TilesetPropertiesView();
    tilesetPropertiesView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120));
    tilesetPropertiesView.setAlignmentX(Component.LEFT_ALIGNMENT);

    // list
    tilePatternsListModel = new TilePatternsListModel();
    tilePatternsList = new JList(tilePatternsListModel);
    tilePatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tilePatternsList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    tilePatternsList.setVisibleRowCount(-1); // make the rows as wide as possible
    tilePatternsList
        .getSelectionModel()
        .addListSelectionListener(new TilePatternListSelectionListener());
    tilePatternsList.setCellRenderer(new TilePatternListRenderer());

    tilePatternsList.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_DELETE) {
              if (tileset != null && tileset.getSelectedTilePattern() != null) {
                tileset.removeTilePattern();
              }
            }
          }
        });

    JScrollPane listScroller = new JScrollPane(tilePatternsList);
    listScroller.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    listScroller.setAlignmentX(Component.LEFT_ALIGNMENT);

    // tile view
    tilePatternView = new TilePatternView();
    tilePatternView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 300));
    tilePatternView.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(tilesetPropertiesView);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(listScroller);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(tilePatternView);
  }
  public TextAreaCellEditor() {
    super();
    scroll = new JScrollPane(this);
    scroll.setBorder(BorderFactory.createEmptyBorder());
    // scroll.setViewportBorder(BorderFactory.createEmptyBorder());

    setLineWrap(true);
    setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));

    KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK);
    getInputMap(JComponent.WHEN_FOCUSED).put(enter, KEY);
    getActionMap()
        .put(
            KEY,
            new AbstractAction() {
              @Override
              public void actionPerformed(ActionEvent e) {
                stopCellEditing();
              }
            });
  }
  // int jlabel3_state=0;
  public void mouseClicked(MouseEvent e) {
    JLabel source = (JLabel) e.getSource();
    if (label_state.get(source) == 0) {
      if (source.getName() == "jLabel11") {
        if (challenge_file == null) {
          JOptionPane.showMessageDialog(null, "Challenge File Not Loaded");
        } else {
          reset_labelState();
          active_label = (JLabel) source;
          label_state.put(source, 1);
          try {
            ImageIcon icon =
                new javax.swing.ImageIcon(getClass().getResource("resources/images/pause.jpg"));
            jLabel11.setIcon(icon);
          } catch (Exception et) {
            JOptionPane.showMessageDialog(null, et.toString());
          }
        }

      } else {
        reset_labelState();
        active_label = (JLabel) source;
        label_state.put(source, 1);
      }
      source.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLUE));
    } else {
      active_label = null;
      label_state.put(source, 0);
      if (source.getName() == "jLabel11") {
        try {
          ImageIcon icon =
              new javax.swing.ImageIcon(getClass().getResource("resources/images/play.jpg"));
          jLabel11.setIcon(icon);
        } catch (Exception et) {
          JOptionPane.showMessageDialog(null, et.toString());
        }
      }
      source.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLUE));
    }
  }
 public MainPanel() {
   super(new BorderLayout());
   initComboBox(combo01);
   int g = 5;
   JPanel p = new JPanel(new GridLayout(2, 2, g, g));
   p.add(combo00);
   p.add(new JLabel("<- default"));
   p.add(combo01);
   p.add(new JLabel("<- RightPopupMenuListener"));
   setBorder(BorderFactory.createEmptyBorder(g, g, g, g));
   add(p, BorderLayout.NORTH);
   setPreferredSize(new Dimension(320, 240));
 }
  public ColorChooserDemo() {
    super(new BorderLayout());

    // 设置一个标签,做广告的。也用来显示用户选择的颜色。
    banner = new JLabel("欢迎使用颜色选择器!", JLabel.CENTER);
    banner.setForeground(Color.yellow);
    banner.setBackground(Color.blue);
    banner.setOpaque(true);
    banner.setFont(new Font("SansSerif", Font.BOLD, 24));
    banner.setPreferredSize(new Dimension(100, 65));

    JPanel bannerPanel = new JPanel(new BorderLayout());
    bannerPanel.add(banner, BorderLayout.CENTER);
    bannerPanel.setBorder(BorderFactory.createTitledBorder("广告"));

    // 设置选择颜色选择器
    tcc = new JColorChooser(banner.getForeground()); // 设置初始颜色
    tcc.getSelectionModel().addChangeListener(this); // 给所有模式添加监听
    tcc.setBorder(BorderFactory.createTitledBorder("选择颜色"));

    add(bannerPanel, BorderLayout.CENTER);
    add(tcc, BorderLayout.PAGE_END);
  }
Exemple #24
0
  public void buildPopulationBox() {
    rebuilding = true;
    populationBox.removeAll();
    peopleList = new ArrayList<Object>();
    famList = new ArrayList<Family>();
    peopleList.addAll(ctxt.individualCensus);
    String plur = (peopleList.size() == 1 ? "" : "s");
    populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS));
    populationBox.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Current Population"));
    populationBox.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(8, 0)));
    indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur);
    indivLabel.setAlignmentX(0.5f);
    populationBox.add(indivLabel);
    if (peopleList.size() > 0) {
      JPanel indivBtnBox = new JPanel();
      indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] indMenu = genIndMenu(peopleList);
      indPick = new JComboBox(indMenu);
      indPick.addActionListener(listener);
      indPick.setActionCommand("view/edit person");
      indPick.setMinimumSize(sizer2);
      indPick.setMaximumSize(sizer2);
      indPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Person"));
      indivBtnBox.add(indPick);
      populationBox.add(indivBtnBox);
    } //  end of if-any-people-exist

    famList.addAll(ctxt.familyCensus); //  end of filtering deleted records
    plur = (famList.size() == 1 ? "y" : "ies");
    famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur);
    famLabel.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(0, 4)));
    populationBox.add(famLabel);
    if (famList.size() > 0) {
      JPanel famBtnBox = new JPanel();
      famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] famMenu = genFamMenu(famList);
      famPick = new JComboBox(famMenu);
      famPick.addActionListener(listener);
      famPick.setActionCommand("view/edit family");
      famPick.setMinimumSize(sizer2);
      famPick.setMaximumSize(sizer2);
      famPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Family"));
      famBtnBox.add(famPick);
      populationBox.add(famBtnBox);
    } //  end of if-any-families-exist
    rebuilding = false;
  } //  end of method buildPopulationBox
  boolean initControlCenter(String title) {

    this.setTitle(title);
    // set up content pane
    Container content = this.getContentPane();
    content.setLayout(new BorderLayout());
    panelAbout.setLayout(new BorderLayout());

    JTextArea textArea =
        new JTextArea(
            "PlayStation 2 Virtual File System release 1.0 \n\nSpecials thanks to our betatester\nPS2Linux Betatester: Mrbrown and Sarah\nPS2 betatester: Oobles, Caveman, Gamebytes, Ping^Spike, Josekenshin, Padawan, pakor, SandraThx and Rolando\n\nAdded little gui in java swing\nAdded feature to choose directory for media files\nAdded support for properties files\nCheck for updates at ps2dev.org\n\nRelease 1.2\n\nRewrite io with java NIO\nadded console mode support\n");
    textArea.setEditable(false);

    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setPreferredSize(new Dimension(250, 250));
    TitledBorder aboutBorder = BorderFactory.createTitledBorder("Change log and Greets");
    aboutBorder.setTitleColor(Color.blue);
    panelAbout.setBorder(aboutBorder);

    panelAbout.add(areaScrollPane);
    // set up tabbed pane
    content.add(jtpMain);

    jtpMain.addTab("Configure", panelChooser);
    jtpMain.addTab("About", panelAbout);
    //  set up display area
    // jtaDisplay.setEditable(false);
    // jtaDisplay.setLineWrap(true);
    // jtaDisplay.setMargin(new Insets(5, 5, 5, 5));
    // jtaDisplay.setFont(
    // new Font("Monospaced", Font.PLAIN, iDEFAULT_FontSize));
    // jspDisplay.setViewportView(jtaDisplay);
    // jspDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
    // panelConsole.add(jspDisplay, BorderLayout.CENTER);
    // panelConsole.add(jtfCommand, BorderLayout.SOUTH);
    // panelConsole.add(jtaDisplay, BorderLayout.CENTER);

    // listener: window closer
    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    this.vResize();
    return true;
  }
  Graphic(int width, int height, int ux, int uy) {
    frameWidth = width;
    frameHeight = height;

    unityX = ux;
    unityY = uy;

    this.setOpaque(true);
    this.setPreferredSize(new Dimension(frameWidth, frameHeight));
    this.setBorder(BorderFactory.createBevelBorder(1));

    instance = this;

    function = new FunctionGraphic(new MyTestFunction());
  }
Exemple #27
0
  @SuppressWarnings("OverridableMethodCallInConstructor")
  Notepad() {
    super(true);

    // Trying to set Nimbus look and feel
    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception ignored) {
    }

    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());

    // create the embedded JTextComponent
    editor = createEditor();
    // Add this as a listener for undoable edits.
    editor.getDocument().addUndoableEditListener(undoHandler);

    // install the command table
    commands = new HashMap<Object, Action>();
    Action[] actions = getActions();
    for (Action a : actions) {
      commands.put(a.getValue(Action.NAME), a);
    }

    JScrollPane scroller = new JScrollPane();
    JViewport port = scroller.getViewport();
    port.add(editor);

    String vpFlag = getProperty("ViewportBackingStore");
    if (vpFlag != null) {
      Boolean bs = Boolean.valueOf(vpFlag);
      port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE);
    }

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add("North", createToolbar());
    panel.add("Center", scroller);
    add("Center", panel);
    add("South", createStatusbar());
  }
  public ListDemo() {
    super(new BorderLayout());

    listModel = new DefaultListModel();

    // Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);
    list.setVisibleRowCount(5);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton hireButton = new JButton(hireString);
    HireListener hireListener = new HireListener(hireButton);
    hireButton.setActionCommand(hireString);
    hireButton.addActionListener(hireListener);
    hireButton.setEnabled(false);

    loadButton = new JButton(loadString);
    loadButton.setActionCommand(loadString);
    loadButton.addActionListener(new loadListener());

    employeeName = new JTextField(10);
    employeeName.addActionListener(hireListener);
    employeeName.getDocument().addDocumentListener(hireListener);
    String name;
    if (listModel.size() > 0) {
      name = listModel.getElementAt(list.getSelectedIndex()).toString();
    }
    // Create a panel that uses BoxLayout.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.add(loadButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(employeeName);
    buttonPane.add(hireButton);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(listScrollPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
  }
  public void setUseFlatUI(boolean b) {
    main.setContentAreaFilled(!b);
    main.setFocusPainted(!b);
    main.setBorderPainted(!b);
    main.setMargin(new Insets(1, 1, 1, 1));

    popper.setContentAreaFilled(!b);
    popper.setFocusPainted(!b);
    popper.setBorderPainted(!b);
    popper.setMargin(new Insets(1, 1, 1, 1));

    setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    setOpaque(false);

    MouseAdapter ma =
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            main.setContentAreaFilled(true);
            main.setBackground(new Color(216, 240, 254));
            // m.getMainButton().setForeground( Color.black );
            setBorder(new LineBorder(new Color(200, 200, 200), 1));
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

            popper.setBackground(new Color(242, 242, 242));
            popper.setContentAreaFilled(true);
            popper.setBorder(menu.getBorder());
          }

          public void mouseExited(MouseEvent e) {
            main.setContentAreaFilled(false);
            //	c.setForeground( Color.black );
            setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
            setCursor(Cursor.getDefaultCursor());

            popper.setContentAreaFilled(false);
            popper.setBorder(null);
          }
        };

    main.addMouseListener(ma);
    popper.addMouseListener(ma);
  }
  public void setGoal(File file) throws FileNotFoundException, IOException {
    FileInputStream fstream = new FileInputStream(file);
    // Get the object of DataInputStream
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    // Read File Line By Line
    strLine = br.readLine();
    input_count = Integer.valueOf(br.readLine());
    results = new String[input_count];
    tapes = new String[input_count];

    for (int i = 0; i < input_count; i++) {
      results[i] = br.readLine();
      tapes[i] = br.readLine();
    }
    jLabel1.setText(strLine);
    jLabel1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
    br.close();
  }