示例#1
0
文件: Screen.java 项目: mogo69/wormA
 private void createCaptions() {
   left_panel = Box.createVerticalBox();
   right_panel = Box.createVerticalBox();
   left_captions = new LinkedHashMap<Integer, JLabel>();
   right_captions = new LinkedHashMap<Integer, JLabel>();
   for (int i = 3; i >= 0; --i) {
     left_captions.put(i, new JLabel());
     right_captions.put(i, new JLabel());
   }
   return;
 }
示例#2
0
  private void initComponents() {
    FlippingSplitPane upperPane = new FlippingSplitPane("SpellBooksTop");
    Box box = Box.createVerticalBox();
    JScrollPane pane = new JScrollPane(availableTable);
    pane.setPreferredSize(new Dimension(250, 300));
    box.add(pane);
    box.add(Box.createVerticalStrut(5));
    {
      Box hbox = Box.createHorizontalBox();
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(new JLabel(LanguageBundle.getString("InfoSpells.set.auto.book")));
      hbox.add(Box.createHorizontalGlue());
      box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    {
      Box hbox = Box.createHorizontalBox();
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(defaultBookCombo);
      hbox.add(Box.createHorizontalGlue());
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(addButton);
      hbox.add(Box.createHorizontalStrut(5));
      box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setLeftComponent(box);

    box = Box.createVerticalBox();
    box.add(new JScrollPane(selectedTable));
    box.add(Box.createVerticalStrut(5));
    {
      Box hbox = Box.createHorizontalBox();
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(removeButton);
      hbox.add(Box.createHorizontalGlue());
      box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setRightComponent(box);
    upperPane.setResizeWeight(0);
    setTopComponent(upperPane);

    FlippingSplitPane bottomPane = new FlippingSplitPane("SpellBooksBottom");
    bottomPane.setLeftComponent(spellsPane);
    bottomPane.setRightComponent(classPane);
    setBottomComponent(bottomPane);
    setOrientation(VERTICAL_SPLIT);
  }
示例#3
0
 public void init(List<T> sources) {
   this.sources = sources;
   consoles = new HashMap<T, ConsolePanel>();
   singleNodeGUIS = new ArrayList<JComponent>();
   // setPreferredSize(new Dimension(1000,700));
   JSplitPane[] leftAndRight =
       new JSplitPane[] {
         new JSplitPane(JSplitPane.VERTICAL_SPLIT), new JSplitPane(JSplitPane.VERTICAL_SPLIT)
       };
   for (int i = 0; i < sources.size(); i++) {
     T t = sources.get(i);
     Box box = Box.createVerticalBox();
     ConsolePanel console = createConsole();
     consoles.put(t, console);
     JScrollPane jsp = new JScrollPane(console);
     jsp.setMinimumSize(new Dimension(600, 300));
     jsp.setPreferredSize(new Dimension(600, 300));
     jsp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
     box.add(jsp);
     // box.add(Box.createVerticalGlue());
     box.add(createInputTF(t));
     box.add(Box.createVerticalStrut(3));
     box.setBorder(BorderFactory.createTitledBorder(String.valueOf(t)));
     singleNodeGUIS.add(box);
     leftAndRight[i / 2].add(box);
   }
   add(leftAndRight[0]);
   add(leftAndRight[1]);
 }
  /**
   * Creates the Factor definition subform
   *
   * @return - JPanel containing the Factor definition subform.
   */
  private Container createTransposedView() {

    Box subformContainer = Box.createVerticalBox();

    transposedSpreadsheetSubform =
        new TransposedSubForm(
            "spreadsheet data",
            FieldTypes.ROW,
            transposedSpreadsheetModel.getFields(),
            transposedSpreadsheetModel.getNumberOfRecords(),
            width,
            height,
            transposedSpreadsheetModel.getData(),
            transposedSpreadsheetModel.getSpreadsheet().getDataEntryEnv());

    transposedSpreadsheetSubform.createGUI();

    transposedSpreadsheetSubform.addPropertyChangeListener(
        "rowAdded",
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            updateInformation();
          }
        });

    subformContainer.add(Box.createVerticalStrut(15));
    subformContainer.add(transposedSpreadsheetSubform);
    subformContainer.add(Box.createVerticalStrut(15));

    return subformContainer;
  }
  /** Adds the button row and the Spam Button */
  private void addButtonRow() {
    if (BUTTON_ROW != null) {
      SOUTH_PANEL = Box.createVerticalBox();
      SOUTH_PANEL.setOpaque(false);

      SOUTH_PANEL.add(Box.createVerticalStrut(GUIConstants.SEPARATOR));

      JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout(new GridBagLayout());

      GridBagConstraints gbc = new GridBagConstraints();

      gbc.gridx = 1;
      gbc.gridy = 0;
      gbc.anchor = GridBagConstraints.CENTER;
      gbc.fill = GridBagConstraints.NONE;
      gbc.gridwidth = GridBagConstraints.RELATIVE;
      gbc.weightx = 1;

      buttonPanel.add(BUTTON_ROW, gbc);

      buttonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 64));
      SOUTH_PANEL.add(buttonPanel);

      MAIN_PANEL.add(SOUTH_PANEL);
    }
  }
示例#6
0
  /**
   * Create the XPath task pane
   *
   * @return XPath task pane
   */
  private JPanel createXpathExtractorTasksPanel() {
    Box xpathActionPanel = Box.createVerticalBox();

    Box selectorAndButton = Box.createHorizontalBox();

    Border margin = new EmptyBorder(5, 5, 0, 5);
    xpathActionPanel.setBorder(margin);
    xpathExpressionField =
        new JLabeledTextField(JMeterUtils.getResString("xpath_tester_field")); // $NON-NLS-1$

    JButton xpathTester =
        new JButton(JMeterUtils.getResString("xpath_tester_button_test")); // $NON-NLS-1$
    xpathTester.setActionCommand(XPATH_TESTER_COMMAND);
    xpathTester.addActionListener(this);

    selectorAndButton.add(xpathExpressionField);
    selectorAndButton.add(xpathTester);

    xpathActionPanel.add(selectorAndButton);
    xpathActionPanel.add(xmlConfPanel);
    xpathActionPanel.add(getFragment);

    xpathResultField = new JTextArea();
    xpathResultField.setEditable(false);
    xpathResultField.setLineWrap(true);
    xpathResultField.setWrapStyleWord(true);

    JPanel xpathTasksPanel = new JPanel(new BorderLayout(0, 5));
    xpathTasksPanel.add(xpathActionPanel, BorderLayout.NORTH);
    xpathTasksPanel.add(GuiUtils.makeScrollPane(xpathResultField), BorderLayout.CENTER);

    return xpathTasksPanel;
  }
示例#7
0
 protected void initButtons(JComponent panel) {
   mergeRunnerB = new JButton(GecoIcon.createIcon(GecoIcon.MergeRunner));
   mergeRunnerB.setToolTipText(Messages.uiGet("RegistryBoard.MergeEcardTooltip")); // $NON-NLS-1$
   mergeRunnerB.setEnabled(false);
   mergeRunnerB.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           RunnerRaceData mergedData =
               control()
                   .mergeRunnerWithData(
                       getSelectedRunner(), wizard().getECardData(), wizard().getSourceRunner());
           wizard().closeAfterMerge(mergedData);
         }
       });
   overwriteWarningL = new JLabel(GecoIcon.createIcon(GecoIcon.Overwrite));
   overwriteWarningL.setToolTipText(
       Messages.uiGet("RegistryBoard.OverwriteWarning")); // $NON-NLS-1$
   overwriteWarningL.setVisible(false);
   mergeRunnerB.setAlignmentX(MergeWizard.CENTER_ALIGNMENT);
   overwriteWarningL.setAlignmentX(MergeWizard.CENTER_ALIGNMENT);
   Box buttons = Box.createVerticalBox();
   buttons.add(mergeRunnerB);
   buttons.add(overwriteWarningL);
   panel.add(buttons, buttonsCol(3));
 }
示例#8
0
  /**
   * Creates a dialog that is showing the histogram for the given node (if null one is selected for
   * you)
   */
  private JPanel createNormalityTestDialog(Node selected) {
    DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel();

    QQPlot qqPlot = new QQPlot(dataSet, selected);
    NormalityTestEditorPanel editorPanel = new NormalityTestEditorPanel(qqPlot, dataSet);

    JTextArea display =
        new JTextArea(
            NormalityTests.runNormalityTests(
                dataSet, (ContinuousVariable) qqPlot.getSelectedVariable()),
            20,
            65);
    display.setEditable(false);
    editorPanel.addPropertyChangeListener(new NormalityTestListener(display));

    Box box = Box.createHorizontalBox();
    box.add(display);

    box.add(Box.createHorizontalStrut(3));
    box.add(editorPanel);
    box.add(Box.createHorizontalStrut(5));
    box.add(Box.createHorizontalGlue());

    Box vBox = Box.createVerticalBox();
    vBox.add(Box.createVerticalStrut(15));
    vBox.add(box);
    vBox.add(Box.createVerticalStrut(5));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(vBox, BorderLayout.CENTER);

    return panel;
  }
示例#9
0
 private void jbInit() throws Exception {
   box1 = Box.createVerticalBox();
   this.getContentPane().setLayout(borderLayout1);
   close.setText("Close");
   close.addActionListener(new CellHelpWindow_close_actionAdapter(this));
   jLabel1.setText("Recommendation");
   jLabel2.setText("Description");
   jPanel1.setLayout(borderLayout2);
   jPanel2.setLayout(borderLayout3);
   description.setText("jTextPane1");
   description.setContentType("text/html");
   scp1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   scp1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   scp1.setToolTipText("");
   recom.setText("");
   recom.setContentType("text/html");
   this.getContentPane().add(box1, BorderLayout.CENTER);
   box1.add(jPanel1, null);
   box1.add(jPanel2, null);
   this.getContentPane().add(jPanel3, BorderLayout.SOUTH);
   jPanel3.add(close, null);
   jPanel2.add(jLabel1, BorderLayout.NORTH);
   jPanel2.add(scp2, BorderLayout.CENTER);
   scp2.getViewport().add(recom, null);
   jPanel2.add(scp2, BorderLayout.CENTER);
   jPanel1.add(jLabel2, BorderLayout.NORTH);
   jPanel1.add(scp1, BorderLayout.CENTER);
   scp1.getViewport().add(description, null);
 }
/**
 * Description: <br>
 * Copyright (C), 2005-2008, Yeeku.H.Lee <br>
 * This program is protected by copyright laws. <br>
 * Program Name: <br>
 * Date:
 *
 * @author Yeeku.H.Lee [email protected]
 * @version 1.0
 */
public class TestBoxSpace {
  private Frame f = new Frame("测试");
  // 定义水平摆放组件的Box对象
  private Box horizontal = Box.createHorizontalBox();
  // 定义垂直摆放组件的Box对象
  private Box vertical = Box.createVerticalBox();

  public void init() {
    horizontal.add(new Button("水平按钮一"));
    horizontal.add(Box.createHorizontalGlue());
    horizontal.add(new Button("水平按钮二"));
    // 水平方向不可拉伸的间距,其宽度为10px
    horizontal.add(Box.createHorizontalStrut(10));
    horizontal.add(new Button("水平按钮三"));
    vertical.add(new Button("垂直按钮一"));
    vertical.add(Box.createVerticalGlue());
    vertical.add(new Button("垂直按钮二"));
    // 垂直方向不可拉伸的间距,其高度为10px
    vertical.add(Box.createVerticalStrut(10));
    vertical.add(new Button("垂直按钮三"));
    f.add(horizontal, BorderLayout.NORTH);
    f.add(vertical);
    f.pack();
    f.setVisible(true);
  }

  public static void main(String[] args) {
    new TestBoxSpace().init();
  }
}
示例#11
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed

    OpenFastaFile f = new OpenFastaFile("", "");
    try { // f.showSaveDataDialog();
      FilePath = f.showOpenDataDialog();
    } catch (IOException ex) {
      //            Logger.getLogger(Browser.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (FilePath.isEmpty()) {
      return;
    }
    Box vertical = Box.createVerticalBox();
    vertical.setSize(this.scrollPane1.getWidth(), this.scrollPane1.getHeight());
    siRNA s = new siRNA(new File(FilePath));

    siRnaInputArea.setText(s.getGene());

    if (s.isValid()) {
      List list = s.siRNA();
      t1.setText(list.get(0).toString());
      t2.setText(list.get(1).toString());
      s1.setForeground(Color.black);
      s2.setForeground(Color.black);
    }
  } // GEN-LAST:event_jButton1ActionPerformed
  /** Performs the action of loading a session from a file. */
  public void actionPerformed(ActionEvent e) {
    DataModel dataModel = getDataEditor().getSelectedDataModel();

    if (!(dataModel instanceof DataSet)) {
      JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Must be a tabular data set.");
      return;
    }

    this.dataSet = (DataSet) dataModel;

    SpinnerNumberModel spinnerNumberModel = new SpinnerNumberModel(getNumLags(), 0, 20, 1);
    JSpinner jSpinner = new JSpinner(spinnerNumberModel);
    jSpinner.setPreferredSize(jSpinner.getPreferredSize());

    spinnerNumberModel.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            SpinnerNumberModel model = (SpinnerNumberModel) e.getSource();
            setNumLags(model.getNumber().intValue());
          }
        });

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

    Box b = Box.createVerticalBox();
    Box b1 = Box.createHorizontalBox();
    b1.add(new JLabel("Number of time lags: "));
    b1.add(Box.createHorizontalGlue());
    b1.add(Box.createHorizontalStrut(15));
    b1.add(jSpinner);
    b1.setBorder(new EmptyBorder(10, 10, 10, 10));
    b.add(b1);

    panel.add(b, BorderLayout.CENTER);

    EditorWindow editorWindow = new EditorWindow(panel, "Create time series data", "Save", true);
    DesktopController.getInstance().addEditorWindow(editorWindow);
    editorWindow.setVisible(true);

    editorWindow.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameClosed(InternalFrameEvent e) {
            EditorWindow window = (EditorWindow) e.getSource();

            if (!window.isCanceled()) {
              if (dataSet.isContinuous()) {
                createContinuousTimeSeriesData();
              } else if (dataSet.isDiscrete()) {
                createDiscreteTimeSeriesData();
              } else {
                JOptionPane.showMessageDialog(
                    JOptionUtils.centeringComp(),
                    "Data set must be either continuous or discrete.");
              }
            }
          }
        });
  }
示例#13
0
  /**
   * Layout the GUI components for this RootFolder with an expandable JTree on the left of a
   * SplitPane and the main panel on the right.
   */
  private void layoutWithFolderTree() {

    // get the JTree Component
    tree = getFolderTree();

    if (rootIsVisible == false) // hide the root node
    {
      tree.setRootVisible(false);
    }

    // Enable tool tips.
    ToolTipManager.sharedInstance().registerComponent(tree);

    // embed the JTree in a scrollpane
    JScrollPane treeScrollPane = new JScrollPane(tree);

    // the left and right sides of the JSplitPane
    JComponent leftside, rightside = mainPanel;

    if (globalParams == null && buttonPanel == null) {
      // Create a split pane with the treePane on the left and the main panel on the right
      leftside = treeScrollPane;
    } else {
      /* the left side has global parameters and/or buttons so we need to create a
       * vertical split pane for the tree and the parameters/buttons
       */
      JComponent globalParamsBox = globalParams;

      // globalparams could be null but buttonpanel could not be
      if (buttonPanel != null) {
        // add buttonPanel to a vertical box with globalParams
        Box box = Box.createVerticalBox();

        if (globalParams != null) {
          box.add(globalParams);
          box.add(Box.createVerticalGlue());
        }
        box.add(buttonPanel);

        globalParamsBox = box;
      }

      // create the vertical split pane
      leftside =
          new JSplitPane(
              JSplitPane.VERTICAL_SPLIT, treeScrollPane, new JScrollPane(globalParamsBox));
    }

    // create the horizontal split pane with the left and right sides
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftside, rightside);
    splitPane.setOneTouchExpandable(true);

    // set the divider location to be 150 pixels from the left
    splitPane.setDividerLocation(150);

    // add the split pane to this component
    add(splitPane, BorderLayout.CENTER);
  }
示例#14
0
  private void initPanel() {
    Box mainPanel = Box.createVerticalBox();
    Box descLabelP = Box.createHorizontalBox();
    Box clusterP = Box.createHorizontalBox();
    Box centralP = Box.createVerticalBox();

    mainPanel.add(Box.createHorizontalStrut(10));
    mainPanel.add(centralP);
    mainPanel.add(Box.createHorizontalStrut(10));

    centralP.add(Box.createVerticalStrut(10));
    centralP.add(descLabelP);
    centralP.add(Box.createVerticalStrut(10));
    centralP.add(clusterP);
    centralP.add(Box.createVerticalStrut(10));

    setLayout(new GridLayout(2, 1));
    add(mainPanel);
    clustDet = new FuzzyClusterDetails(session, clustering, numClusters);
    add(clustDet);

    // Stringa informativa
    JPanel p = new JPanel(new GridLayout(1, 1));
    p.add(new JLabel(PANEL_TITLE));
    descLabelP.add(p, BorderLayout.NORTH);

    // Pannello laterale con JList Clusters
    JPanel p1 = new JPanel(new BorderLayout(5, 5));
    JPanel temp = new JPanel(new FlowLayout());
    temp.add(getClusterList());
    p1.add(temp, BorderLayout.WEST);

    // Pannello Con JTable
    JPanel p2 = new JPanel(new BorderLayout(5, 10));
    desctText = new JLabel(DESCR_LABEL);
    p2.add(desctText, BorderLayout.NORTH);
    p2.add(getTable(), BorderLayout.CENTER);
    String cur = DESCR_LABEL.replaceFirst("X", Integer.toString(clustList.getSelectedIndex() + 1));
    cur = cur.replaceFirst("Y", Integer.toString(numClusters));
    desctText.setText(
        cur.replaceFirst("Z", Integer.toString(infos.numElem[clustList.getSelectedIndex()])));

    p1.add(p2, BorderLayout.CENTER);
    clusterP.add(p1);
  }
 private JComponent build() {
   JComponent comp = Box.createVerticalBox();
   comp.add(new JScrollPane(list));
   comp.add(valueField, BorderLayout.SOUTH);
   comp.add(activityBox);
   comp.add(new JXTitledSeparator("below: edited bindings"));
   comp.add(uncommittedBox);
   return comp;
 }
示例#16
0
 private Box getPanel() {
   Box result = Box.createVerticalBox();
   result.setBorder(new EmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH));
   result.add(getLabel());
   result.add(Box.createVerticalGlue());
   result.add(getBar());
   result.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
   return result;
 }
示例#17
0
  /**
   * Constructs an SQLPanel using a given annotation for the 'ref' part of the URL (the part after
   * the '#' character).
   *
   * @param refString the string used for annotating
   * @param refArea true to use a multi-line text area for the ref field, false for a one-line field
   */
  public SQLPanel(String refString, boolean refArea) {
    super(new BorderLayout());
    stack = new LabelledComponentStack();
    add(stack, BorderLayout.NORTH);
    Font inputFont = stack.getInputFont();

    /* Protocol input field. */
    protoField = new JComboBox();
    protoField.addItem("");
    protoField.addItem("mysql");
    protoField.addItem("postgresql");
    protoField.setEditable(true);
    protoField.setFont(inputFont);
    stack.addLine("Protocol", "jdbc:", protoField);

    /* Host input field. */
    hostField = new JComboBox();
    hostField.addItem("");
    hostField.addItem("localhost");
    hostField.setEditable(true);
    hostField.setFont(inputFont);
    stack.addLine("Host", "://", hostField);

    /* Database field. */
    dbField = new JTextField(12);
    stack.addLine("Database name", "/", dbField);

    /* Reference field in the one-line case. */
    if (!refArea) {
      refField = new JTextField(32);
      stack.addLine(refString, "#", refField);
    }

    /* Username input field. */
    userField = new JTextField(12);
    userField.setText(System.getProperty("user.name"));
    stack.addLine("User name", null, userField);

    /* Password input field. */
    passField = new JPasswordField(12);
    stack.addLine("Password", null, passField);

    /* Reference field in the multi-line case. */
    if (refArea) {
      JComponent refHolder = new JPanel(new BorderLayout());
      Box labelBox = Box.createVerticalBox();
      labelBox.add(new JLabel(refString + ": # "));
      labelBox.add(Box.createVerticalGlue());
      refHolder.add(labelBox, BorderLayout.WEST);
      refField = new JTextArea();
      refField.setFont(Font.decode("Monospaced"));
      refHolder.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
      refHolder.add(new JScrollPane(refField), BorderLayout.CENTER);
      refHolder.setPreferredSize(new Dimension(400, 100));
      add(refHolder, BorderLayout.CENTER);
    }
  }
示例#18
0
  /** 生成面板内容 */
  private void createContent() {
    contentPanel = new JPanel(new BorderLayout());
    panel.add(contentPanel, BorderLayout.CENTER);

    Box message = Box.createVerticalBox();
    message.setBorder(BorderFactory.createEtchedBorder());

    dateImg = new JLabel(new ImageIcon(TMFrame.class.getResource("/images/calendar.gif")));
    String today = Today.getYear() + "年" + Today.getMonth() + "月" + Today.getDate() + "日";
    date = new JLabel(today);
    date.setFont(font);
    week = new JLabel(Today.getWeek());
    week.setFont(font);
    nameImg = new JLabel(new ImageIcon(TMFrame.class.getResource("/images/role.png")));
    name = new JLabel(staffInfo.getStaffName());
    name.setFont(font);
    role = new JLabel("总经理");
    role.setFont(font);

    Box messageTop = Box.createVerticalBox();
    Box messageCenter = Box.createHorizontalBox();
    Box messageBottom = Box.createVerticalBox();

    messageTop.add(Box.createVerticalStrut(1));
    messageCenter.add(Box.createHorizontalStrut(5));
    messageCenter.add(dateImg);
    messageCenter.add(Box.createHorizontalStrut(2));
    messageCenter.add(date);
    messageCenter.add(Box.createHorizontalStrut(20));
    messageCenter.add(week);
    messageCenter.add(Box.createHorizontalStrut(50));
    messageCenter.add(nameImg);
    messageCenter.add(Box.createHorizontalStrut(2));
    messageCenter.add(name);
    messageCenter.add(Box.createHorizontalStrut(20));
    messageCenter.add(role);
    messageCenter.add(Box.createHorizontalGlue());
    messageBottom.add(Box.createVerticalStrut(1));

    message.add(messageTop);
    message.add(messageCenter);
    message.add(messageBottom);
    contentPanel.add(message, BorderLayout.NORTH);
  }
示例#19
0
 public Component getControls() {
   if (controls == null) {
     Box b = Box.createVerticalBox();
     b.add(new JLabel(Resources.getString("Notes.invisible"))); // $NON-NLS-1$
     text = new TextConfigurer(null, null);
     b.add(text.getControls());
     controls = b;
   }
   return controls;
 }
示例#20
0
    public RealCellEditor() {

      Box box = Box.createVerticalBox();

      box.add(Box.createVerticalStrut(10));

      // Add main title
      JLabel conflictLabel = new JLabel("Konflikt / debatt");
      conflictLabel.setAlignmentX(0);
      conflictLabel.setFont(conflictLabel.getFont().deriveFont((float) 15));
      JPanel labelPanel = new JPanel();
      labelPanel.add(conflictLabel);
      box.add(labelPanel);

      box.add(Box.createVerticalStrut(15));

      // Add help text
      JLabel helpLabel =
          new JLabel(
              "<html><center>Her kan du beskrive en konflikt<br> eller en debatt med ulike<br>synspunkter og argumenter.</center></html>");
      helpLabel.setFont(conflictLabel.getFont().deriveFont((float) 11));
      JPanel helpPanel = new JPanel();
      helpPanel.add(helpLabel);
      box.add(helpPanel);

      box.add(Box.createVerticalStrut(15));

      // Add topic with label
      JPanel tp = new JPanel();
      tp.setLayout(new FlowLayout(FlowLayout.CENTER));

      JPanel wrap = new JPanel();
      wrap.add(topic);
      tp.add(wrap);
      wrap.setBorder(BorderFactory.createTitledBorder("Sentralt spørsmål eller tema:"));

      box.add(tp);
      box.add(Box.createVerticalStrut(10));

      JPanel vps = new JPanel(new GridLayout(1, 2));

      // Add viewpoints
      vp1.setBorder(BorderFactory.createTitledBorder("Synspunkt:"));
      vp1.setTextBackground(new Color(208, 255, 217));

      vp2.setBorder(BorderFactory.createTitledBorder("Motstridende synspunkt:"));
      vp2.setTextBackground(new Color(255, 216, 207));
      vps.add(vp1);
      vps.add(vp2);

      box.add(Box.createVerticalStrut(5));
      box.add(vps);
      editorComponent.setLayout(new GridLayout(1, 1));
      editorComponent.add(box);
    }
 // Center given button in a box, centered vertically and 6 pixels on left and right
 private Box createBoxForButton(JButton button) {
   Box buttonRow = Box.createHorizontalBox();
   buttonRow.add(Box.createHorizontalStrut(6));
   buttonRow.add(button);
   buttonRow.add(Box.createHorizontalStrut(6));
   Box buttonBox = Box.createVerticalBox();
   buttonBox.add(Box.createVerticalGlue());
   buttonBox.add(buttonRow);
   buttonBox.add(Box.createVerticalGlue());
   return buttonBox;
 }
示例#22
0
 public void loginScreen() {
   getContentPane().removeAll();
   System.gc();
   LoginPane loginPane = new LoginPane(this);
   Box box = Box.createVerticalBox();
   box.add(Box.createVerticalGlue());
   box.add(loginPane);
   box.add(Box.createVerticalGlue());
   add(box);
   paintAll(getGraphics());
 }
示例#23
0
  private void init() {
    setLayout(new BorderLayout());
    setBorder(makeBorder());

    Box box = Box.createVerticalBox();
    box.add(makeTitlePanel());
    box.add(createScopePanel(true));
    box.add(makeExtractorPanel());
    add(box, BorderLayout.NORTH);
    add(makeParameterPanel(), BorderLayout.CENTER);
  }
示例#24
0
  // создание телефона и отображение его на экране
  public void CreatePhone() {
    DisplayField = new JTextField();
    DisplayField.setPreferredSize(new Dimension(500, 150));
    DisplayField.setMaximumSize(new Dimension(500, 150));
    DisplayField.setEditable(false);
    DisplayField.setHorizontalAlignment(SwingConstants.CENTER);
    DisplayField.setFont(DisplayFont);

    DisplayField.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    JPanel ButtonPanel = addNumberButtons(DisplayField);
    JPanel CallBox = addFuncButtons();
    Box contentBox = Box.createVerticalBox();
    contentBox.setPreferredSize(new Dimension(600, 620));
    contentBox.add(Box.createVerticalGlue());
    contentBox.add(Box.createVerticalStrut(40));
    contentBox.add(DisplayField);
    contentBox.add(Box.createVerticalStrut(10));
    contentBox.add(ButtonPanel);
    contentBox.add(Box.createVerticalStrut(10));
    contentBox.add(CallBox);
    contentBox.add(Box.createVerticalGlue());

    HistoryList();
    JButton sleep = Sleep();
    JPanel slPanel = new JPanel();
    slPanel.setLayout(new BorderLayout());
    slPanel.add(sleep, BorderLayout.EAST);
    Box boxForList = Box.createVerticalBox();
    boxForList.setPreferredSize(new Dimension(140, 620));
    boxForList.add(Box.createVerticalGlue());
    contentBox.add(Box.createVerticalStrut(10));
    boxForList.add(listBox);
    boxForList.add(Box.createVerticalGlue());

    this.add(slPanel, BorderLayout.NORTH);
    this.add(contentBox, BorderLayout.WEST);
    this.add(boxForList, BorderLayout.CENTER);
    MainFrame.container.add(this, BorderLayout.CENTER);
  }
示例#25
0
  public LinearRegressionPanel(Application app, StatDialog statDialog) {

    this.app = app;
    kernel = app.getKernel();
    this.statDialog = statDialog;

    this.setOpaque(true);
    this.setBackground(Color.WHITE);
    this.setLayout(new BorderLayout());

    // north panel with regression equation
    Box northPanel = Box.createVerticalBox();
    northPanel.add(new JLabel(" ---- regresion equation ----"));
    northPanel.add(new JLabel(" ----------------------------"));

    // south panel with additional statistics
    Box southPanel = Box.createVerticalBox();
    southPanel.add(new JLabel(" ---- regresion equation ----"));
    southPanel.add(new JLabel(" ----------------------------"));

    // set up table
    model = new DefaultTableModel();
    headerModel = new DefaultListModel();
    JTable table = new JTable(model);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setGridColor(GeoGebraColorConstants.TABLE_GRID_COLOR);
    table.setShowGrid(true);

    // table row header
    JList rowHeader = new JList(headerModel);
    rowHeader.setFixedCellWidth(50);
    rowHeader.setFixedCellHeight(table.getRowHeight() + table.getRowMargin());
    rowHeader.setCellRenderer(new RowHeaderRenderer(table));

    // add table to scroll pane
    JScrollPane scroll = new JScrollPane(table);
    scroll.setRowHeaderView(rowHeader);

    this.add(scroll, BorderLayout.CENTER);
  }
示例#26
0
public class AttributesPanel extends JComponent {
  private boolean settingcollection = false;
  private Box box = Box.createVerticalBox();

  Vector tobeduplicated = new Vector();

  public AttributesPanel() {
    this.setLayout(new BorderLayout());
    super.add(box, BorderLayout.CENTER);
  }

  public void setEntity(java.lang.Object ent) {
    Method[] methods = ent.getClass().getDeclaredMethods();
    box.removeAll();
    for (Method m : methods) {
      if (m.getName().toLowerCase().startsWith("get")) {
        String attName = m.getName().substring(3);
        Object result;
        try {
          result = m.invoke(ent, new Object[] {});
          String value = "null";
          if (result != null) value = result.toString();
          JPanel attPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
          attPane.add(new JLabel(attName + " : " + m.getReturnType().getName() + " = " + value));
          box.add(attPane);
        } catch (IllegalArgumentException e) {

          e.printStackTrace();
        } catch (IllegalAccessException e) {

          e.printStackTrace();
        } catch (InvocationTargetException e) {

          e.printStackTrace();
        }
      }
    }
  }

  public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException {

    JFrame jf = new JFrame();

    AttributesPanel colpal = new AttributesPanel();
    colpal.setEntity(new FrameFact("hola"));
    colpal.setEntity(new FrameFact("hola"));
    jf.getContentPane().add(colpal);
    jf.pack();
    jf.show();
    jf.pack();
  }
}
示例#27
0
  // Method to build the dialog box for help.
  private void buildDialogBox() {
    // Set the JDialog window properties.
    setTitle("Stack Trace Detail");
    setResizable(false);
    setSize(dialogWidth, dialogHeight);

    // Append the stack trace output to the display area.
    displayArea.append(eStackTrace);

    // Create horizontal and vertical scrollbars for box.
    displayBox = Box.createHorizontalBox();
    displayBox = Box.createVerticalBox();

    // Add a JScrollPane to the Box.
    displayBox.add(new JScrollPane(displayArea));

    // Define behaviors of container.
    c.setLayout(null);
    c.add(displayBox);
    c.add(okButton);

    // Set scroll pane bounds.
    displayBox.setBounds(
        (dialogWidth / 2) - ((displayAreaWidth / 2) + 2),
        (top + (offsetMargin / 2)),
        displayAreaWidth,
        displayAreaHeight);

    // Set the behaviors, bounds and action listener for the button.
    okButton.setBounds(
        (dialogWidth / 2) - (buttonWidth / 2),
        (displayAreaHeight + offsetMargin),
        buttonWidth,
        buttonHeight);

    // Set the font to the platform default Font for the object with the
    // properties of bold and font size of 11.
    okButton.setFont(new Font(okButton.getFont().getName(), Font.BOLD, 11));

    // The class implements the ActionListener interface and therefore
    // provides an implementation of the actionPerformed() method.  When a
    // class implements ActionListener, the instance handler returns an
    // ActionListener.  The ActionListener then performs actionPerformed()
    // method on an ActionEvent.
    okButton.addActionListener(this);

    // Set the screen and display dialog window in relation to screen size.
    setLocation((dim.width / 2) - (dialogWidth / 2), (dim.height / 2) - (dialogHeight / 2));

    // Display JDialog.
    show();
  } // End of buildDialogBox method.
示例#28
0
  private void createBoxPlotPanel() {

    // create components
    ckShowOutliers = new JCheckBox();
    ckShowOutliers.addActionListener(this);

    // layout
    Box p = Box.createVerticalBox();
    p.add(LayoutUtil.flowPanel(ckShowOutliers));

    boxPlotPanel = new JPanel(new BorderLayout());
    boxPlotPanel.add(p, BorderLayout.NORTH);
  }
示例#29
0
  private void createScatterplotPanel() {

    // create components
    ckShowLines = new JCheckBox();
    ckShowLines.addActionListener(this);

    // layout
    Box p = Box.createVerticalBox();
    p.add(insetPanel(tab1, ckShowLines));

    scatterplotPanel = new JPanel(new BorderLayout());
    scatterplotPanel.add(p, BorderLayout.NORTH);
  }
示例#30
0
    AddEntityUI() {

      super(disp.getJFrame(), "Add Physics Entity");
      Box box = Box.createVerticalBox();
      box.setBorder(PANE_BORDER);
      int i = 0;
      for (EntityProperty prop : EntityProperty.values()) {
        JLabel label = new JLabel(prop.label);
        Component option = null;
        if (prop.type == FLOAT || prop.type == STRING || prop.type == VECTOR) {
          option = new JTextField(FIELD_SIZE);
          switch (prop) {
            case MASS:
              ((JTextField) option).setText(DEF_MASS);
              break;
            case VELOCITY:
              ((JTextField) option).setText(DEF_VEL);
              break;
            case COLL_FACTOR:
              ((JTextField) option).setText(DEF_CF);
              break;
            case SIZE:
              ((JTextField) option).setText(DEF_SIZE);
          }
        } else if (prop.type == BOOLEAN) {
          option = new JCheckBox();
        }
        options[i++] = option;

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(BorderLayout.WEST, label);
        JPanel optPan = new JPanel();
        optPan.add(option);
        panel.add(BorderLayout.EAST, optPan);
        box.add(panel);
      }
      add(BorderLayout.CENTER, box);
      JPanel btnPanel = new JPanel();
      JButton add = new JButton("Confirm");
      add.addActionListener(new ProcessAddEntity());
      JButton cancel = new JButton("Cancel");
      OnCloseListener closeListener = new OnCloseListener();
      cancel.addActionListener(closeListener);
      cancel.setPreferredSize(add.getPreferredSize());
      btnPanel.add(add);
      btnPanel.add(cancel);
      add(BorderLayout.SOUTH, btnPanel);
      pack();
      setLocationRelativeTo(null);
      addWindowListener(closeListener);
    }