コード例 #1
0
ファイル: Plot2Da.java プロジェクト: hramasamy/evosys
  public Plot2Da() {
    check_ = new JCheckBox("Hold on");
    plot_ = new Plot2D();

    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 2, 2);
    c.weightx = 1.0;
    c.weighty = 1.0;

    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 0;
    add(check_, c);

    c.gridwidth = 1;
    c.gridheight = 1;
    c.gridx = 0;
    c.gridy = 1;
    c.fill = GridBagConstraints.REMAINDER;
    c.ipadx = plot_.getSize().width + 100;
    c.ipady = plot_.getSize().height + 100;
    plot_.setBackground(Color.WHITE);

    add(plot_, c);

    setBorder(BorderFactory.createEtchedBorder());
  }
コード例 #2
0
ファイル: ViewLinksPanel.java プロジェクト: than-aa/docdoku
  private void createLayout() {
    mViewDocButton.setHorizontalAlignment(SwingConstants.LEFT);
    mViewDocButton.setEnabled(false);
    mLinksScrollPane.getViewport().add(mLinksList);
    setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = GUIConstants.INSETS;
    constraints.gridwidth = 1;

    constraints.gridheight = 2;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.BOTH;
    add(mLinksScrollPane, constraints);

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridheight = 1;
    constraints.gridx = 1;
    add(mViewDocButton, constraints);
  }
コード例 #3
0
  public MA_ScrollPane(
      Vector period_types, int scrollbarDisplayPolicy, Chart parent_chart, Properties print_props) {
    super(scrollbarDisplayPolicy);

    if (print_props != null) print_properties = print_props;
    MA_Configuration config = MA_Configuration.application_instance();
    chart = parent_chart;
    main_graph = new MainGraph();
    indicator_graph = new LowerGraph(main_graph);
    GridBagLayout gblayout = new GridBagLayout();
    GridBagConstraints gbconstraints = new GridBagConstraints();

    main_panel = new Panel(new BorderLayout());
    add(main_panel, "Center");
    graph_panel = new Panel(gblayout);
    main_panel.add(graph_panel, "Center");

    // Set GridBagLayout constraints such that the main graph is at
    // the top and takes about 2/3 of available height and the
    // indicator graph is below the main graph and takes the remaining
    // 1/3 of the height and both graph panels grow/shrink when the
    // window is resized.
    gbconstraints.gridx = 0;
    gbconstraints.gridy = 0;
    gbconstraints.gridwidth = 9;
    gbconstraints.gridheight = 6;
    gbconstraints.weightx = 1;
    gbconstraints.weighty = 1;
    gbconstraints.fill = GridBagConstraints.BOTH;
    gblayout.setConstraints(main_graph, gbconstraints);
    graph_panel.add(main_graph);
    gbconstraints.gridx = 0;
    gbconstraints.gridy = 6;
    gbconstraints.gridwidth = 9;
    gbconstraints.gridheight = 3;
    gbconstraints.weightx = 1;
    gbconstraints.weighty = 1;
    gbconstraints.fill = GridBagConstraints.BOTH;
    gblayout.setConstraints(indicator_graph, gbconstraints);
    graph_panel.add(indicator_graph);
    main_graph.set_framecolor(new Color(0, 0, 0));
    main_graph.set_borderTop(0);
    main_graph.set_borderBottom(1);
    main_graph.set_borderLeft(0);
    main_graph.set_borderRight(1);
    main_graph.setGraphBackground(config.background_color());
    main_graph.setSize(400, 310);

    indicator_graph.set_framecolor(new Color(0, 0, 0));
    indicator_graph.set_borderTop(0);
    indicator_graph.set_borderBottom(1);
    indicator_graph.set_borderLeft(0);
    indicator_graph.set_borderRight(1);
    indicator_graph.setGraphBackground(config.background_color());
    indicator_graph.setSize(400, 150);
  }
コード例 #4
0
  /**
   * Used to create the top panel describing the current feedback question
   *
   * @param fb Feedback question to describe
   * @return Panel with title and description
   */
  public JPanel createQuestionDataPanel(AbstractFeedbackType fb) {
    JPanel questionPanel = new JPanel();
    questionPanel.setLayout(new GridBagLayout());
    questionPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));

    GridBagConstraints leftBoxConst = new GridBagConstraints();
    leftBoxConst.anchor = GridBagConstraints.LINE_START;
    leftBoxConst.gridx = 0;
    leftBoxConst.gridy = 0;
    leftBoxConst.gridheight = 2;

    JLabel titleLabel = new JLabel(fb.getTitle());
    GridBagConstraints titleLabelConst = new GridBagConstraints();
    titleLabelConst.anchor = GridBagConstraints.CENTER;
    titleLabelConst.gridx = 1;
    titleLabelConst.gridy = 0;
    titleLabelConst.weightx = 1.0;
    Font titleLabelFont = titleLabel.getFont();
    titleLabel.setFont(
        new Font(
            titleLabelFont.getName(),
            Font.BOLD,
            titleLabelFont.getSize() + 4)); // increase label font size by 2

    JLabel descLabel = new JLabel(fb.getDescription());
    GridBagConstraints descLabelConst = new GridBagConstraints();
    descLabelConst.anchor = GridBagConstraints.CENTER;
    descLabelConst.gridx = 1;
    descLabelConst.gridy = 1;
    descLabelConst.weightx = 1.0;

    JLabel exclLabel = new JLabel("!");
    exclLabel.setAlignmentX(RIGHT_ALIGNMENT);
    exclLabel.setToolTipText("Response is mandatory");
    try {
      exclLabel.setFont(loadGlyphFont(titleLabelFont.getSize() + 4));
      exclLabel.setText("\ue101");
    } catch (FontFormatException | IOException e) {
      e.printStackTrace();
    }
    GridBagConstraints rightBoxConst = new GridBagConstraints();
    rightBoxConst.anchor = GridBagConstraints.LINE_END;
    rightBoxConst.gridx = 2;
    rightBoxConst.gridy = 0;
    rightBoxConst.gridheight = 2;
    rightBoxConst.ipadx = 4;

    questionPanel.add(new JPanel(), leftBoxConst);
    questionPanel.add(titleLabel, titleLabelConst);
    questionPanel.add(descLabel, descLabelConst);
    questionPanel.add(fb.isMandatory() ? exclLabel : new JPanel(), rightBoxConst);

    return questionPanel;
  }
コード例 #5
0
  /**
   * Adds contact entry labels.
   *
   * @param nameLabelGridWidth the grid width of the contact entry name label
   */
  private void addLabels(int nameLabelGridWidth) {
    remove(nameLabel);
    remove(rightLabel);
    remove(displayDetailsLabel);

    if (treeNode != null && !(treeNode instanceof GroupNode))
      constraints.insets = new Insets(0, 0, V_GAP, H_GAP);
    else constraints.insets = new Insets(0, 0, 0, H_GAP);

    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.weightx = 1f;
    constraints.weighty = 0f;
    constraints.gridheight = 1;
    constraints.gridwidth = nameLabelGridWidth;
    this.add(nameLabel, constraints);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = nameLabelGridWidth + 1;
    constraints.gridy = 0;
    constraints.gridheight = 3;
    constraints.weightx = 0f;
    constraints.weighty = 1f;
    this.add(rightLabel, constraints);

    if (treeNode != null && treeNode instanceof ContactNode) {
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.gridy = 1;
      constraints.weightx = 1f;
      constraints.weighty = 0f;
      constraints.gridwidth = nameLabelGridWidth;
      constraints.gridheight = 1;

      this.add(displayDetailsLabel, constraints);
    } else if (treeNode != null && treeNode instanceof GroupNode) {
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.gridy = 1;
      constraints.weightx = 1f;
      constraints.weighty = 0f;
      constraints.gridwidth = nameLabelGridWidth;
      constraints.gridheight = 1;

      this.add(displayDetailsLabel, constraints);
    }
  }
コード例 #6
0
ファイル: CallStackComponent.java プロジェクト: ybakos/Tecs-3
  // Initializing this component.
  private void jbInit() {
    callStackTable.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            callStackTable_focusGained(e);
          }

          public void focusLost(FocusEvent e) {
            callStackTable_focusLost(e);
          }
        });
    callStackTable.setTableHeader(null);
    callStackTable.setDefaultRenderer(callStackTable.getColumnClass(0), getCellRenderer());
    scrollPane = new JScrollPane(callStackTable);
    setVisibleRows(DEFAULT_VISIBLE_ROWS);
    scrollPane.setLocation(0, 27);
    setBorder(BorderFactory.createEtchedBorder());
    // this.setLayout(null);
    this.setLayout(new GridBagLayout());
    nameLbl.setText("Call Stack");
    nameLbl.setBounds(new Rectangle(3, 4, 70, 23));
    nameLbl.setFont(Utilities.labelsFont);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 7;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.PAGE_END;
    c.gridx = 0;
    c.gridy = 2;
    this.add(scrollPane, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0.0;
    c.gridwidth = 3;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(5, 0, 0, 0);
    this.add(nameLbl, c);
  }
コード例 #7
0
  private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) {
    lastAddedButton = button;

    constraints.insets = new Insets(0, 0, V_GAP, 0);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = gridX;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    this.add(button, constraints);

    int yBounds =
        TOP_BORDER
            + BOTTOM_BORDER
            + 2 * V_GAP
            + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height
            + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText())
                .height;

    button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT);

    button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    setButtonBg(button, gridX, isLast);

    return button.getWidth();
  }
コード例 #8
0
  public static void addToGridBag(
      GridBagLayout grid,
      Container cont,
      Component comp,
      int x,
      int y,
      int gw,
      int gh,
      double wx,
      double wy,
      int fill,
      int anchor) {
    // now the constraints
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    gbc.weightx = wx;
    gbc.weighty = wy;
    gbc.fill = fill;
    gbc.gridwidth = gw;
    gbc.gridheight = gh;
    gbc.anchor = anchor;

    cont.add(comp);
    grid.setConstraints(comp, gbc);
  }
コード例 #9
0
  public void defineOwnConstraints(
      Component c,
      int y,
      int x,
      int w,
      int h,
      int weightx,
      int weighty,
      int fill,
      int anchor,
      int bottomInsets,
      int leftInsets,
      int rightInsets,
      int topInsets) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets.bottom = bottomInsets;
    gbc.insets.left = leftInsets;
    gbc.insets.right = rightInsets;
    gbc.insets.top = topInsets;

    gbc.weightx = weightx;
    gbc.weighty = weighty;

    gbc.fill = fill;
    gbc.anchor = anchor;

    gbc.gridx = x - 1;
    gbc.gridy = y - 1;

    gbc.gridwidth = w;
    gbc.gridheight = h;

    setConstraints(c, gbc);
  }
コード例 #10
0
ファイル: QueryDB.java プロジェクト: chenyuguxing/utils
 private void add(Component c, GridBagConstraints gbc, int x, int y, int w, int h) {
   gbc.gridx = x;
   gbc.gridy = y;
   gbc.gridwidth = w;
   gbc.gridheight = h;
   getContentPane().add(c, gbc);
 }
コード例 #11
0
  /**
   * public MutableStatusBar(String s1, String s2, String s3) { super(); status_1 = new JLabel(s1);
   * status_2 = new JLabel(s2); status_3 = new JLabel(s3); this.init(); }.
   */
  protected void init() {
    this.setLayout(new GridBagLayout());
    this.setBorder(BorderFactory.createEmptyBorder(3, 2, 1, 1));
    final GridBagConstraints constraints = new GridBagConstraints();

    // status_1.setHorizontalAlignment(JLabel.CENTER);
    status_1.setBorder(
        new CompoundBorder(
            new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2)));
    status_1.setPreferredSize(new Dimension(180, 16));

    status_2.setBorder(
        new CompoundBorder(
            new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2)));
    status_2.setPreferredSize(new Dimension(200, 16));

    status_3.setBorder(
        new CompoundBorder(
            new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2)));
    status_3.setPreferredSize(new Dimension(300, 16));

    greenStatusIcon =
        new MutableImageLabel(resource.getIcon("green_off.gif"), resource.getIcon("green_on.gif"));
    greenStatusIcon.setBorder(new EmptyBorder(2, 2, 2, 1));

    redStatusIcon =
        new MutableImageLabel(resource.getIcon("red_off.gif"), resource.getIcon("red_on.gif"));
    redStatusIcon.setBorder(new EmptyBorder(2, 1, 2, 3));
    // =====================================================================

    constraints.insets = new Insets(0, 0, 0, 4);
    constraints.anchor = GridBagConstraints.EAST;
    constraints.fill = GridBagConstraints.VERTICAL;

    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    this.add(status_1, constraints);

    constraints.weightx = 0.0;
    constraints.gridx++;
    this.add(status_2, constraints);

    constraints.gridx = 2;
    this.add(status_3, constraints);

    constraints.gridx++;
    if (greenStatusIcon != null) {
      this.add(greenStatusIcon, constraints);
    }

    constraints.insets = new Insets(0, 0, 0, 0);
    constraints.gridx++;
    if (redStatusIcon != null) {
      this.add(redStatusIcon, constraints);
    }
  }
コード例 #12
0
ファイル: Slider.java プロジェクト: suranyami/israfel
  public void insert(Container cont, GridBagLayout gbl, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = x;
    gbc.gridy = y;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.fill = GridBagConstraints.NONE;

    gbl.setConstraints(name, gbc);
    cont.add(name);

    gbc.gridx = x + 1;
    gbc.weightx = 10;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    gbl.setConstraints(scroll, gbc);
    cont.add(scroll);

    gbc.gridx = x + 2;
    gbc.weightx = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;

    gbl.setConstraints(field, gbc);
    cont.add(field);
  }
コード例 #13
0
  /** Creates the panel with the optional components. */
  private void _setupOptionsPanel(JComponent[] components) {
    JPanel mainButtons = new JPanel();
    JPanel emptyPanel = new JPanel();
    GridBagLayout gbLayout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    mainButtons.setLayout(gbLayout);

    for (JComponent b : components) {
      mainButtons.add(b);
    }
    mainButtons.add(emptyPanel);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;

    for (JComponent b : components) {
      gbLayout.setConstraints(b, c);
    }

    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.SOUTH;
    c.gridheight = GridBagConstraints.REMAINDER;
    c.weighty = 1.0;

    gbLayout.setConstraints(emptyPanel, c);

    _optionsPanel.add(mainButtons, BorderLayout.CENTER);
  }
コード例 #14
0
  private static JPanel makePanel(String title, String href) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createTitledBorder(title));

    JLabel label = new JLabel(href);

    JEditorPane editor = new JEditorPane("text/html", href);
    editor.setOpaque(false);
    editor.setEditable(false);
    editor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    GridBagConstraints c = new GridBagConstraints();
    c.gridheight = 1;

    c.gridx = 0;
    c.insets = new Insets(5, 5, 5, 0);
    c.anchor = GridBagConstraints.EAST;
    c.gridy = 0;
    p.add(new JLabel("JLabel: "), c);
    c.gridy = 2;
    p.add(new JLabel("JEditorPane: "), c);

    c.gridx = 1;
    c.weightx = 1d;
    c.anchor = GridBagConstraints.WEST;
    c.gridy = 0;
    p.add(label, c);
    c.gridy = 2;
    p.add(editor, c);

    return p;
  }
コード例 #15
0
ファイル: dbfShow.java プロジェクト: akerigan/staxer
 public static void addComponent(
     Container container,
     Component component,
     int gridx,
     int gridy,
     int gridwidth,
     int gridheight,
     int fill,
     int anchor)
     throws AWTException {
   LayoutManager lm = container.getLayout();
   if (!(lm instanceof GridBagLayout)) {
     throw new AWTException("Invalid layout" + lm);
   } else {
     GridBagConstraints gbc = new GridBagConstraints();
     gbc.gridx = gridx;
     gbc.gridy = gridy;
     gbc.gridwidth = gridwidth;
     gbc.gridheight = gridheight;
     gbc.fill = fill;
     gbc.anchor = anchor;
     ((GridBagLayout) lm).setConstraints(component, gbc);
     container.add(component);
   }
 }
コード例 #16
0
ファイル: Utilities.java プロジェクト: bily/fsxp
 public static void addComponent(
     Container container,
     Component component,
     int gridx,
     int gridy,
     int gridwidth,
     int gridheight,
     int fill,
     int anchor,
     Insets insets,
     int ipadx,
     int ipady,
     double weightx,
     double weighty) {
   java.awt.LayoutManager lm = container.getLayout();
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbc.gridwidth = gridwidth;
   gbc.gridheight = gridheight;
   gbc.fill = fill;
   gbc.anchor = anchor;
   gbc.insets = insets;
   gbc.ipadx = ipadx;
   gbc.ipady = ipady;
   gbc.weightx = weightx;
   gbc.weighty = weighty;
   ((GridBagLayout) lm).setConstraints(component, gbc);
   container.add(component);
 }
    public void addForDisplay(CTalkativeTextPane pane, LabelPair<String, String> lp) {
      GridBagLayout gridbag = (GridBagLayout) getLayout();
      labelPair = lp;
      label = new JLabel(labelPair.getSingular(), JLabel.LEFT);
      pane.getDocument().addDocumentListener(this);

      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.LINE_START;
      c.insets = new Insets(0, 20, 0, 00);
      gridbag.setConstraints(pane, c);
      add(pane);

      c = new GridBagConstraints();
      c.gridx = 1;
      c.gridy = 0;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.LINE_START;
      c.insets = new Insets(0, 0, 0, 20);
      gridbag.setConstraints(label, c);
      add(label);

      JPanel filler = new JPanel();
      filler.setBackground(white);
      c = new GridBagConstraints();
      c.gridx = 2;
      c.gridy = 0;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.weightx = 0.8;
      c.weighty = 0.8;
      c.fill = GridBagConstraints.BOTH;
      c.anchor = GridBagConstraints.LINE_END;
      gridbag.setConstraints(filler, c);
      add(filler);

      filler = null;
      c = null;
    }
コード例 #18
0
  /** Creates the property iterator panel initially disabled. */
  public GeneratorPropertyIteratorPanel() {

    String[] options = {"Disabled", "Enabled"};
    ComboBoxModel cbm = new DefaultComboBoxModel(options);
    m_StatusBox.setModel(cbm);
    m_StatusBox.setSelectedIndex(0);
    m_StatusBox.addActionListener(this);
    m_StatusBox.setEnabled(false);
    m_ConfigureBut.setEnabled(false);
    m_ConfigureBut.addActionListener(this);
    JPanel buttons = new JPanel();
    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    buttons.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
    //    buttons.setLayout(new GridLayout(1, 2));
    buttons.setLayout(gb);
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 5;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.insets = new Insets(0, 2, 0, 2);
    buttons.add(m_StatusBox, constraints);
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.weightx = 5;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    buttons.add(m_ConfigureBut, constraints);
    buttons.setMaximumSize(
        new Dimension(buttons.getMaximumSize().width, buttons.getMinimumSize().height));
    setBorder(BorderFactory.createTitledBorder("Generator properties"));
    setLayout(new BorderLayout());
    add(buttons, BorderLayout.NORTH);
    //    add(Box.createHorizontalGlue());
    m_ArrayEditor.setBorder(BorderFactory.createEtchedBorder());
    m_ArrayEditor.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent e) {
            System.err.println("Updating experiment property iterator array");
            m_Exp.setPropertyArray(m_ArrayEditor.getValue());
          }
        });
    add(m_ArrayEditor, BorderLayout.CENTER);
  }
コード例 #19
0
ファイル: BehaviorTree.java プロジェクト: northern-bites/tool
  private void setupWindowAndListeners() {
    // Initialize Objects
    title = new JLabel("Coordinated Behavior Tree", JLabel.CENTER);
    treeScroller = new JScrollPane();
    treeNodes = new Vector<PBTreeNode>();
    treeView = new JTree(treeNodes);
    stratView = new JList();
    formView = new JList();
    roleView = new JList();
    subRoleView = new JList();

    // Setup our display selection drop down list
    selectorList = new Vector<String>();
    selectorList.add(PBTREE_ID);
    selectorList.add(STRAT_ID);
    selectorList.add(FORM_ID);
    selectorList.add(ROLE_ID);
    selectorList.add(SUBROLE_ID);
    displaySelector = new JComboBox(selectorList);
    displaySelector.addActionListener(this);
    treeScroller.getViewport().setView(treeView);
    treeMode = PBTREE_ID;
    treeScroller.setFocusable(false);
    treeScroller.addMouseListener(this);
    subRoleView.addMouseListener(this);

    // Setup Layout
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gridbag);

    // Add Items
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(title, c);
    c.gridheight = 2;
    add(title);

    gridbag.setConstraints(displaySelector, c);
    add(displaySelector);

    c.gridheight = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(treeScroller, c);
    add(treeScroller);
  }
 /**
  * Hilfsmethode für das GridBagLayout zur Positionierung der Elemente.
  *
  * @param x die x-Position im Grid
  * @param y die y-Position im Grid
  * @param width gibt die Anzahl der Spalten an, die die Komponente nutzen soll
  * @param height gibt die Anzahl der Zeilen an, die die Komponente nutzen soll
  * @return die Rahmenbedingungen für eine Komponente
  */
 private GridBagConstraints makegbc(int x, int y, int width, int height) {
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridx = x;
   gbc.gridy = y;
   gbc.gridwidth = width;
   gbc.gridheight = height;
   gbc.insets = new Insets(1, 5, 1, 1);
   return gbc;
 }
コード例 #21
0
ファイル: Controller.java プロジェクト: tdms/AdMan
  private void addComponent(Component c, int row, int col, int width, int height) {
    gbContraints.gridx = col;
    gbContraints.gridy = row;

    gbContraints.gridwidth = width;
    gbContraints.gridheight = height;

    layout1.setConstraints(c, gbContraints);
    add(c);
  }
コード例 #22
0
 public header() {
   super();
   JLabel name = new JLabel("Welcome MR. ANAND");
   JLabel counter = new JLabel("SONGS REMAINING : 50");
   setLayout(new GridBagLayout());
   GridBagConstraints cc = new GridBagConstraints();
   // setPreferredSize(new Dimension(100,20));
   cc.insets = new Insets(3, 3, 3, 3);
   cc.gridx = 0;
   cc.gridy = 0;
   cc.gridwidth = 5;
   cc.gridheight = 1;
   add(name, cc);
   cc.gridx = 5;
   cc.gridy = 0;
   cc.gridwidth = 2;
   cc.gridheight = 1;
   add(counter, cc);
 }
コード例 #23
0
 // For setting the gridbagconstraints for this application
 public static void setConstraints(GridBagConstraints c, int fill, int col, int row) {
   c.fill = fill;
   c.weightx = 1.0;
   c.weighty = 1.0;
   c.gridx = col;
   c.gridy = row;
   c.gridwidth = 1;
   c.gridheight = 1;
   Insets insets = new Insets(5, 5, 5, 5);
   c.insets = insets;
 }
 protected GridBagConstraints createConstraints(int x, int y) {
   GridBagConstraints c = new GridBagConstraints();
   c.gridx = x;
   c.gridy = y;
   c.gridwidth = 2;
   c.gridheight = 1;
   c.ipadx = 1;
   c.weightx = 0.5;
   c.weighty = 0.5;
   c.fill = GridBagConstraints.BOTH;
   c.anchor = GridBagConstraints.CENTER;
   return c;
 }
コード例 #25
0
  private static JPanel createTextFieldAndListPanel(
      String label, JTextField textField, JList list) {
    GridBagLayout layout = new GridBagLayout();
    JPanel panel = new JPanel(layout);

    GridBagConstraints cons = new GridBagConstraints();
    cons.gridx = cons.gridy = 0;
    cons.gridwidth = cons.gridheight = 1;
    cons.fill = GridBagConstraints.BOTH;
    cons.weightx = 1.0f;

    JLabel _label = new JLabel(jEdit.getProperty(label));
    layout.setConstraints(_label, cons);
    panel.add(_label);

    cons.gridy = 1;
    Component vs = Box.createVerticalStrut(6);
    layout.setConstraints(vs, cons);
    panel.add(vs);

    cons.gridy = 2;
    layout.setConstraints(textField, cons);
    panel.add(textField);

    cons.gridy = 3;
    vs = Box.createVerticalStrut(6);
    layout.setConstraints(vs, cons);
    panel.add(vs);

    cons.gridy = 4;
    cons.gridheight = GridBagConstraints.REMAINDER;
    cons.weighty = 1.0f;
    JScrollPane scroller = new JScrollPane(list);
    layout.setConstraints(scroller, cons);
    panel.add(scroller);

    return panel;
  }
コード例 #26
0
 /**
  * This method adds the panels to the window and organises them using a GridBagLayout and a
  * JLayeredPane.
  */
 private void populateFrame(Container frame) {
   frame.setLayout(new GridBagLayout());
   GridBagConstraints layoutConstraints = new GridBagConstraints();
   JLayeredPane dungeonArea = new JLayeredPane();
   dungeonArea.setPreferredSize(new Dimension(448, 448));
   dungeonArea.add(dungeonPanel, JLayeredPane.DEFAULT_LAYER);
   // the DungeonPanel is added underneath
   dungeonArea.add(dungeonPanelOverlay, JLayeredPane.PALETTE_LAYER);
   // the mostly transparent DungeonPanelOverlay is added on top in the same position
   layoutConstraints.gridx = 0;
   layoutConstraints.gridy = 0;
   layoutConstraints.gridwidth = 7;
   layoutConstraints.gridheight = 7;
   frame.add(dungeonArea, layoutConstraints);
   layoutConstraints.gridx = 7;
   layoutConstraints.gridwidth = 1;
   frame.add(serverSettings, layoutConstraints);
   layoutConstraints.gridx = 0;
   layoutConstraints.gridy = 7;
   layoutConstraints.gridwidth = 8;
   layoutConstraints.gridheight = 1;
   frame.add(chatPanel, layoutConstraints);
 }
コード例 #27
0
  /*
   * helper class to initialize empty spaces
   * @param int x - column of button
   * @param int y - row of button
   * @param Dimension btnSize - sets the size of the button
   */
  public void createBlankButtons(int x, int y, Dimension btnSize) {
    String output = "";
    Font clueFont = new Font("Arial", Font.PLAIN, 8);

    // initialize next myButton
    btn[activeMyButtons] = new myButton();
    String toolTip = ("" + activeMyButtons);
    btn[activeMyButtons].setDefaultToolTipText(toolTip);
    btn[activeMyButtons].setToolTipText(toolTip);

    // get next available myButton and assign current position
    btn[activeMyButtons].positionX = x;
    btn[activeMyButtons].positionY = y;
    btn[activeMyButtons].button = activeMyButtons;
    btn[activeMyButtons].setPreferredSize(btnSize);
    btn[activeMyButtons].setFont(clueFont);

    // assign GridBagConstraints for //position
    cons.gridx = x;
    cons.gridy = y;
    cons.gridwidth = 1;
    cons.gridheight = 1;
    cons.ipadx = 0;
    cons.ipady = 0;

    // determine position and set alternating color
    if (((x % 2 == 0) && (y % 2 == 0)) || ((x % 2 != 0) && (y % 2 != 0))) {
      btn[activeMyButtons].setBackground(new Color(152, 86, 112));
      btn[activeMyButtons].setDefaultColor(new Color(152, 86, 112));
    } else {

      btn[activeMyButtons].setBackground(new Color(128, 48, 82));
      btn[activeMyButtons].setDefaultColor(new Color(128, 48, 82));
    }

    btn[activeMyButtons].setOpaque(true);
    btn[activeMyButtons].setBorderPainted(false);

    // add button to boardPanel
    this.add(btn[activeMyButtons], cons);
    btn[activeMyButtons].addActionListener(new myActionListener());
    validate();

    // pass output to setOutput()
    output = "activeMyButtons: " + activeMyButtons + " " + btn[activeMyButtons].getDefaultColor();
    // setOutput(output);

    activeMyButtons++;
  }
コード例 #28
0
    /** Initializes the layout of this view. */
    protected void initializeLayout() {
      GridBagConstraints constraints = new GridBagConstraints();

      // Name widgets
      JComponent nameWidgets =
          buildLabeledTextField("LOGIN_PROPERTY_EDITOR_NAME_FIELD", buildNameDocumentAdapter());

      constraints.gridx = 0;
      constraints.gridy = 0;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;
      constraints.weightx = 1;
      constraints.weighty = 0;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.anchor = GridBagConstraints.CENTER;
      constraints.insets = new Insets(0, 0, 0, 0);

      add(nameWidgets, constraints);
      putClientProperty("initialFocus", nameWidgets.getComponent(1));

      // Value widgets
      JComponent valueWidgets =
          buildLabeledTextField("LOGIN_PROPERTY_EDITOR_VALUE_FIELD", buildValueDocumentAdapter());

      constraints.gridx = 0;
      constraints.gridy = 1;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.anchor = GridBagConstraints.PAGE_START;
      constraints.insets = new Insets(5, 0, 0, 0);

      add(valueWidgets, constraints);
    }
コード例 #29
0
 private void addToGridBag(
     GridBagLayout gb,
     GridBagConstraints c,
     Container cont,
     JComponent item,
     int x,
     int y,
     int w,
     int h) {
   c.gridx = x;
   c.gridy = y;
   c.gridwidth = w;
   c.gridheight = h;
   gb.setConstraints(item, c);
   cont.add(item);
 }
コード例 #30
0
ファイル: CpnZoomScreen.java プロジェクト: klesun/jMusic_fork
  // Put the controls on the screen
  private void placeControls() {
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(layout);

    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.5;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.gridx = 0;
    c.gridy = 0;
    c.gridheight = 1;
    layout.setConstraints(startMeasureLabel, c);
    add(startMeasureLabel);

    c.gridx = 1;
    c.gridy = 0;
    c.gridheight = 1;
    layout.setConstraints(startMeasureEdit, c);
    add(startMeasureEdit);

    c.gridx = 0;
    c.gridy = 1;
    c.gridheight = 1;
    layout.setConstraints(measureCountLabel, c);
    add(measureCountLabel);

    c.gridx = 1;
    c.gridy = 1;
    c.gridheight = 1;
    layout.setConstraints(measureCountEdit, c);
    add(measureCountEdit);

    c.gridx = 0;
    c.gridy = 3;
    c.gridheight = 1;
    layout.setConstraints(okButton, c);
    add(okButton);
    okButton.addActionListener(this);

    c.gridx = 1;
    c.gridy = 3;
    c.gridheight = 1;
    add(cancelButton);
    layout.setConstraints(cancelButton, c);

    cancelButton.addActionListener(this);
  }