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
Example #2
0
  /**
   * Creates the contactlist scroll panel defining the parent frame.
   *
   * @param mainFrame The parent frame.
   */
  public ContactListPane(MainFrame mainFrame) {
    this.mainFrame = mainFrame;

    this.chatWindowManager = GuiActivator.getUIService().getChatWindowManager();

    this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.GRAY));

    this.initPluginComponents();
  }
  // 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));
    }
  }
Example #4
0
  private static void insertQuestion(final JTextPane textPane, String str) {
    Document doc = textPane.getDocument();
    try {
      doc.insertString(doc.getLength(), str, null);

      final int pos = doc.getLength();
      System.out.println(pos);
      final JTextField field =
          new JTextField(4) {
            @Override
            public Dimension getMaximumSize() {
              return getPreferredSize();
            }
          };
      field.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
      field.addFocusListener(
          new FocusListener() {
            @Override
            public void focusGained(FocusEvent e) {
              try {
                Rectangle rect = textPane.modelToView(pos);
                rect.grow(0, 4);
                rect.setSize(field.getSize());
                // System.out.println(rect);
                // System.out.println(field.getLocation());
                textPane.scrollRectToVisible(rect);
              } catch (BadLocationException ex) {
                ex.printStackTrace();
              }
            }

            @Override
            public void focusLost(FocusEvent e) {
              /* not needed */
            }
          });
      Dimension d = field.getPreferredSize();
      int baseline = field.getBaseline(d.width, d.height);
      field.setAlignmentY(baseline / (float) d.height);

      SimpleAttributeSet a = new SimpleAttributeSet();
      StyleConstants.setLineSpacing(a, 1.5f);
      textPane.setParagraphAttributes(a, true);

      textPane.insertComponent(field);
      doc.insertString(doc.getLength(), "\n", null);
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
Example #5
0
  private NewPanel() {

    setBackground(Color.decode(ColorManager.getCreatePanelBackground()));
    Dimension dim = new Dimension(200, 120);
    setPreferredSize(dim);
    JTextField text = new JTextField("", 15);
    SubmitButton submit = new SubmitButton(text);
    setBorder(
        BorderFactory.createMatteBorder(
            5, 5, 5, 5, Color.decode(ColorManager.getCreatePanelBorder())));
    JLabel label = new JLabel("Create a new button");
    label.setForeground(Color.decode(ColorManager.getCreatePanelText()));
    add(label);
    add(text);
    add(submit);
  }
Example #6
0
  /**
   * Create a component that will replace the spinner models value with the object returned by
   * <code>spinner.getNextValue</code>. By default the <code>nextButton</code> is a JButton who's
   * <code>ActionListener</code> updates it's <code>JSpinner</code> ancestors model. If a nextButton
   * isn't needed (in a subclass) then override this method to return null.
   *
   * @return a component that will replace the spinners model with the next value in the sequence,
   *     or null
   * @see #installUI
   * @see #createPreviousButton
   */
  protected Component createNextButton() {
    Component tmpButton = super.createNextButton();

    if (tmpButton instanceof JButton) {
      JButton result = new ArrowButton(SwingConstants.NORTH);
      ((ArrowButton) result).setDrawBottomBorder(false);

      result.setBorder(
          BorderFactory.createMatteBorder(1, 1, 0, 1, UIManager.getColor("Button.borderColor")));
      ActionListener al[] = ((JButton) tmpButton).getActionListeners();
      for (int i = 0; i < al.length; i++) result.addActionListener(al[i]);

      MouseListener ml[] = ((JButton) tmpButton).getMouseListeners();
      for (int i = 0; i < ml.length; i++) result.addMouseListener(ml[i]);

      return result;
    } else return tmpButton;
  }
  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();
  }
Example #8
0
    BoggleBoardPanel(int rows, int cols) {
      this.rows = rows;
      this.cols = cols;

      // create a JPanel with rowsXcols GridLayout to hold the DiePanels
      JPanel innerPanel = new JPanel();
      innerPanel.setLayout(new GridLayout(rows, cols, 1, 1));
      innerPanel.setBackground(BACKGROUNDCOLOR);

      // Create Individual DiePanels, and add them
      theDice = new DiePanel[rows][cols];
      for (int row = 0; row < rows; row++) {
        for (int col = 0; col < cols; col++) {
          theDice[row][col] = new DiePanel();

          innerPanel.add(theDice[row][col]);
        }
      }
      innerPanel.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, BACKGROUNDCOLOR));
      this.add(innerPanel);
    }
 public void reset_labelState() {
   for (int i = 2; i < 12; i++) {
     labels[i].setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLUE));
     label_state.put(labels[i], 0);
   }
 }
Example #10
0
  /** Display a frame for browsing issues. */
  private JPanel constructView() {
    // sort the original issues list
    final SortedList<Issue> issuesSortedList = new SortedList<Issue>(issuesEventList, null);

    // filter the sorted issues
    FilterList<Issue> filteredIssues =
        new FilterList<Issue>(issuesSortedList, filterPanel.getMatcherEditor());

    SeparatorList<Issue> separatedIssues =
        new SeparatorList<Issue>(
            filteredIssues,
            GlazedLists.beanPropertyComparator(Issue.class, "subcomponent"),
            0,
            Integer.MAX_VALUE);
    EventList<Issue> separatedIssuesProxyList =
        GlazedListsSwing.swingThreadProxyList(separatedIssues);
    // build the issues table
    issuesTableModel =
        GlazedListsSwing.eventTableModel(separatedIssuesProxyList, new IssueTableFormat());
    final TableColumnModel issuesTableColumnModel =
        new EventTableColumnModel<TableColumn>(new BasicEventList<TableColumn>());
    JSeparatorTable issuesJTable = new JSeparatorTable(issuesTableModel, issuesTableColumnModel);
    issuesJTable.setAutoCreateColumnsFromModel(true);

    issuesJTable.setSeparatorRenderer(new IssueSeparatorTableCell(separatedIssues));
    issuesJTable.setSeparatorEditor(new IssueSeparatorTableCell(separatedIssues));
    issuesSelectionModel = GlazedListsSwing.eventSelectionModel(separatedIssuesProxyList);
    issuesSelectionModel.setSelectionMode(
        ListSelection
            .MULTIPLE_INTERVAL_SELECTION_DEFENSIVE); // multi-selection best demos our awesome
                                                     // selection management
    issuesSelectionModel.addListSelectionListener(new IssuesSelectionListener());
    issuesJTable.setSelectionModel(issuesSelectionModel);
    issuesJTable.getColumnModel().getColumn(0).setPreferredWidth(150);
    issuesJTable.getColumnModel().getColumn(1).setPreferredWidth(400);
    issuesJTable.getColumnModel().getColumn(2).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(3).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(4).setPreferredWidth(250);
    issuesJTable.getColumnModel().getColumn(5).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(6).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(7).setPreferredWidth(1000);
    // turn off cell focus painting
    issuesJTable.setDefaultRenderer(
        String.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(String.class)));
    issuesJTable.setDefaultRenderer(
        Integer.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(Integer.class)));
    issuesJTable.setDefaultRenderer(
        Priority.class, new NoFocusRenderer(new PriorityTableCellRenderer()));
    LookAndFeelTweaks.tweakTable(issuesJTable);
    TableComparatorChooser.install(
        issuesJTable, issuesSortedList, TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD);
    JScrollPane issuesTableScrollPane =
        new JScrollPane(
            issuesJTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    issuesTableScrollPane.getViewport().setBackground(UIManager.getColor("EditorPane.background"));
    issuesTableScrollPane.setBorder(BorderFactory.createEmptyBorder());

    issueDetails = new IssueDetailsComponent(filteredIssues);

    // projects
    EventList<Project> projects = Project.getProjects();
    TransformedList<Project, Project> projectsProxyList =
        GlazedListsSwing.swingThreadProxyList(projects);
    // project select combobox
    DefaultEventComboBoxModel projectsComboModel =
        new DefaultEventComboBoxModel<Project>(projectsProxyList);
    JComboBox projectsCombo = new JComboBox(projectsComboModel);
    projectsCombo.setEditable(false);
    projectsCombo.setOpaque(false);
    projectsCombo.addItemListener(new ProjectChangeListener());
    projectsComboModel.setSelectedItem(new Project(null, "Select a Java.net project..."));

    // build a label to display the number of issues in the issue table
    issueCounter = new IssueCounterLabel(filteredIssues);
    issueCounter.setHorizontalAlignment(SwingConstants.CENTER);
    issueCounter.setForeground(Color.WHITE);

    // throbber
    throbber = new JLabel(THROBBER_STATIC);
    throbber.setHorizontalAlignment(SwingConstants.RIGHT);

    // header bar
    JPanel iconBar = new GradientPanel(GLAZED_LISTS_MEDIUM_BROWN, GLAZED_LISTS_DARK_BROWN, true);
    iconBar.setLayout(new GridLayout(1, 3));
    iconBar.add(projectsCombo);
    iconBar.add(issueCounter);
    iconBar.add(throbber);
    iconBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // assemble all data components on a common panel
    JPanel dataPanel = new JPanel();
    JComponent issueDetailsComponent = issueDetails;
    dataPanel.setLayout(new GridLayout(2, 1));
    dataPanel.add(issuesTableScrollPane);
    dataPanel.add(issueDetailsComponent);

    // draw lines between components
    JComponent filtersPanel = filterPanel.getComponent();
    filtersPanel.setBorder(BorderFactory.createEmptyBorder());
    // filtersPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1,
    // IssuesBrowser.GLAZED_LISTS_DARK_BROWN));
    issueDetailsComponent.setBorder(
        BorderFactory.createMatteBorder(1, 0, 0, 0, GLAZED_LISTS_DARK_BROWN));

    // the outermost panel to layout the icon bar with the other panels
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.add(
        iconBar,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mainPanel.add(
        filtersPanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mainPanel.add(
        Box.createHorizontalStrut(240),
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mainPanel.add(
        dataPanel,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    return mainPanel;
  }