Exemplo n.º 1
0
 /**
  * Adds a radio button group.
  *
  * @param label group label (or null)
  * @param items radio button labels
  * @param rows number of rows
  * @param columns number of columns
  * @param defaultItem button initially selected
  */
 public void addRadioButtonGroup(
     String label, String[] items, int rows, int columns, String defaultItem) {
   Panel panel = new Panel();
   int n = items.length;
   panel.setLayout(new GridLayout(rows, columns, 0, 0));
   CheckboxGroup cg = new CheckboxGroup();
   for (int i = 0; i < n; i++) {
     Checkbox cb = new Checkbox(items[i], cg, items[i].equals(defaultItem));
     cb.addItemListener(this);
     panel.add(cb);
   }
   if (radioButtonGroups == null) radioButtonGroups = new Vector();
   radioButtonGroups.addElement(cg);
   Insets insets = getInsets(5, 10, 0, 0);
   if (label == null || label.equals("")) {
     label = "rbg" + radioButtonGroups.size();
     insets.top += 5;
   } else {
     setInsets(10, insets.left, 0);
     addMessage(label);
     insets.top = 2;
     insets.left += 10;
   }
   c.gridx = 0;
   c.gridy = y;
   c.gridwidth = 2;
   c.anchor = GridBagConstraints.WEST;
   c.insets = new Insets(insets.top, insets.left, 0, 0);
   grid.setConstraints(panel, c);
   add(panel);
   if (Recorder.record || macro) saveLabel(cg, label);
   y++;
 }
Exemplo n.º 2
0
  /**
   * Creates the geomerty input tabbed page
   *
   * @param tabbedPane The TabbedPane to add the tab to
   */
  private void getGeometryInput(JTabbedPane tabbedPane) {
    JPanel geometryInput = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = REMAINDER;
    gbc.fill = BOTH;
    gbc.anchor = NORTHWEST;
    gbc.weighty = 1.0;

    chainwheelGeometryInput.addContentChangeListener(this);
    geometryInput.add(chainwheelGeometryInput, gbc);

    sprocketGeometryInput.addContentChangeListener(this);
    geometryInput.add(sprocketGeometryInput, gbc);

    generalGeometryInput.addContentChangeListener(this);
    geometryInput.add(generalGeometryInput, gbc);

    driveTrainDrawing.addContentChangeListener(this);
    driveTrainOutput.addContentChangeListener(this);

    tabbedPane.addTab(
        Messages.getString("GeometryDetails"),
        null,
        geometryInput,
        Messages.getString("GeometryDetailsTip"));
  }
Exemplo n.º 3
0
  private JPanel makeParameterPanel() {
    expressionField =
        new JLabeledTextField(JMeterUtils.getResString("expression_field")); // $NON-NLS-1$
    attributeField =
        new JLabeledTextField(JMeterUtils.getResString("attribute_field")); // $NON-NLS-1$
    defaultField =
        new JLabeledTextField(JMeterUtils.getResString("default_value_field")); // $NON-NLS-1$
    refNameField = new JLabeledTextField(JMeterUtils.getResString("ref_name_field")); // $NON-NLS-1$
    matchNumberField =
        new JLabeledTextField(JMeterUtils.getResString("match_num_field")); // $NON-NLS-1$

    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    initConstraints(gbc);
    addField(panel, refNameField, gbc);
    resetContraints(gbc);
    addField(panel, expressionField, gbc);
    resetContraints(gbc);
    addField(panel, attributeField, gbc);
    resetContraints(gbc);
    addField(panel, matchNumberField, gbc);
    resetContraints(gbc);
    gbc.weighty = 1;
    addField(panel, defaultField, gbc);
    return panel;
  }
Exemplo n.º 4
0
 private static void showDialog(String[] login) {
   JTextField uf = new JTextField(20);
   uf.setText(login[0]);
   JPasswordField pf = new JPasswordField(20);
   JPanel p = new JPanel(new GridBagLayout());
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.anchor = GridBagConstraints.FIRST_LINE_START;
   gbc.insets.left = 5;
   gbc.insets.bottom = 5;
   gbc.gridx = 0;
   gbc.gridy = 0;
   p.add(new JLabel("User"), gbc);
   gbc.gridx = 1;
   gbc.gridy = 0;
   p.add(uf, gbc);
   gbc.gridx = 0;
   gbc.gridy = 1;
   p.add(new JLabel("Password"), gbc);
   gbc.gridx = 1;
   gbc.gridy = 1;
   p.add(pf, gbc);
   JOptionPane op = new JOptionPane(p);
   op.setOptions(new String[] {"OK", "Cancel"});
   JDialog dlg = op.createDialog(null, "Login");
   dlg.pack();
   int i = SupportUI.show(dlg, op);
   if (i != 0) {
     System.exit(0);
   }
   login[0] = uf.getText().trim();
   login[1] = new String(pf.getPassword());
 }
Exemplo n.º 5
0
  /**
   * Builds the panel for entering the server access preferences
   *
   * @return preferences panel for server settings
   */
  protected JPanel buildContentPanel() {
    JPanel pnl = new JPanel(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();

    // the checkbox for the default UL
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.NORTHWEST;
    gc.weightx = 1.0;
    gc.insets = new Insets(0, 0, 0, 0);
    pnl.add(pnlApiUrlPreferences = new OsmApiUrlInputPanel(), gc);

    // the remaining access properties
    gc.gridy = 1;
    gc.fill = GridBagConstraints.BOTH;
    gc.weightx = 1.0;
    gc.weighty = 1.0;
    gc.insets = new Insets(10, 0, 3, 3);
    pnl.add(buildTabbedServerPreferences(), gc);

    // let the AuthPreferencesPanel know when the API URL changes
    //
    pnlApiUrlPreferences.addPropertyChangeListener(pnlAuthPreferences);

    HelpUtil.setHelpContext(pnl, HelpUtil.ht("/Preferences/Connection"));
    return pnl;
  }
Exemplo n.º 6
0
 private void initGui() {
   this.setLayout(new GridBagLayout());
   this.setBorder(
       new TitledBorder(new EtchedBorder(), dsElement.getAttributeValue(Resources.get("NAME"))));
   // find all partition tables in this dataset
   List<Element> ptList = dsElement.getChildren(Resources.get("PARTITIONTABLE"));
   for (Element ptElement : ptList) {
     List<ArrayList<String>> ptTable = JDomUtils.ptElement2Table(ptElement);
     ptTableMap.put(ptElement.getAttributeValue(Resources.get("NAME")), ptTable);
     // default 0
     ptCurrentIndex.put(ptElement.getAttributeValue(Resources.get("NAME")), 0);
   }
   // find the one has the same user and gui
   HashMap<String, String> conditions = new HashMap<String, String>();
   List<Element> myContainers =
       JDomUtils.findChildElements(dsElement, Resources.get("CONTAINER"), conditions);
   Set<String> ftSet = this.getFlattenPTableName();
   GridBagConstraints c = new GridBagConstraints();
   c.gridy = 0;
   c.gridx = 0;
   c.anchor = GridBagConstraints.FIRST_LINE_START;
   for (Element container : myContainers) {
     if (JDomUtils.isElementHiden(container)) continue;
     // if container is empty, don't add it
     if (!this.isContainerEmpty(container)) {
       this.add(createContainerPanel(container, dsElement, ftSet, false), c);
       c.gridx = c.gridx + 1;
     }
   }
 }
Exemplo n.º 7
0
  /**
   * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as
   * <tt>CallPeer</tt> display name, call duration, security status.
   *
   * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information
   *     such as <tt>CallPeer</tt> display name, call duration, security status
   */
  private Component createStatusBar() {
    // stateLabel
    callStatusLabel.setForeground(Color.WHITE);
    dtmfLabel.setForeground(Color.WHITE);
    callStatusLabel.setText(callPeer.getState().getLocalizedStateString());

    PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridx = 0;
    constraints.gridy = 0;
    statusPanel.add(securityStatusLabel, constraints);
    initSecurityStatusLabel();

    constraints.gridx++;
    statusPanel.add(holdStatusLabel, constraints);

    constraints.gridx++;
    statusPanel.add(muteStatusLabel, constraints);

    constraints.gridx++;
    callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12));
    statusPanel.add(callStatusLabel, constraints);

    constraints.gridx++;
    constraints.weightx = 1f;
    statusPanel.add(dtmfLabel, constraints);

    return statusPanel;
  }
  private JPanel buildUpdateFieldsPanel(PropertyValueModel returningPolicyHolder) {
    GridBagConstraints constraints = new GridBagConstraints();

    JPanel updateFieldPanel = new JPanel(new GridBagLayout());
    updateFieldPanel.setBorder(
        BorderFactory.createCompoundBorder(
            buildTitledBorder("RETURNING_POLICY_UPDATE_FIELD_LABEL"),
            BorderFactory.createEmptyBorder(0, 5, 5, 5)));

    AbstractPanel updateFieldsPanel = updateFieldsPanel(returningPolicyHolder);

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

    updateFieldPanel.add(updateFieldsPanel, constraints);
    addPaneForAlignment(updateFieldsPanel);

    return updateFieldPanel;
  }
Exemplo n.º 9
0
  public void fPassive() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    removeAll();
    invalidate();
    repaint();
    setLayout(gridbag);
    constraints.fill = GridBagConstraints.HORIZONTAL;

    buildConstraints(constraints, 0, 0, 5, 1, 1, 1);
    gridbag.setConstraints(verLabel, constraints);
    add(verLabel);

    buildConstraints(constraints, 0, 1, 5, 1, 1, 1);
    gridbag.setConstraints(autLabel, constraints);
    add(autLabel);

    buildConstraints(constraints, 0, 16, 5, 1, 1, 1);
    gridbag.setConstraints(in, constraints);
    add(in);

    imageCanvas = new SEMCanvas(512, 512, url, this);
    imageCanvas.addMouseListener(this);
    imageCanvas.read_Overlay(0);

    buildConstraints(constraints, 5, 0, 1, 17, 1, 1);
    gridbag.setConstraints(imageCanvas, constraints);
    add(imageCanvas);

    validate();
    repaint();
  }
Exemplo n.º 10
0
  /** Create the dialog. */
  public requestDpixdist() {
    setTitle("Input Lines Height");
    setResizable(false);
    setBounds(100, 100, 333, 169);
    contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPanel);
    GridBagLayout gbl_contentPane = new GridBagLayout();
    gbl_contentPane.columnWidths = new int[] {0, 0, 0, 0};
    gbl_contentPane.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0};
    gbl_contentPane.columnWeights = new double[] {0.0, 0.0, 1.0, Double.MIN_VALUE};
    gbl_contentPane.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    contentPanel.setLayout(gbl_contentPane);

    JLabel lblHeightOfLines = new JLabel("Height of black lines (mm):");
    GridBagConstraints gbc_lblHeightOfLines = new GridBagConstraints();
    gbc_lblHeightOfLines.anchor = GridBagConstraints.EAST;
    gbc_lblHeightOfLines.insets = new Insets(0, 0, 5, 5);
    gbc_lblHeightOfLines.gridx = 1;
    gbc_lblHeightOfLines.gridy = 1;
    contentPanel.add(lblHeightOfLines, gbc_lblHeightOfLines);

    heightText = new JTextField();
    heightText.setMaximumSize(new Dimension(4, 20));
    GridBagConstraints gbc_heightText = new GridBagConstraints();
    gbc_heightText.fill = GridBagConstraints.HORIZONTAL;
    gbc_heightText.insets = new Insets(0, 0, 5, 0);
    gbc_heightText.gridx = 2;
    gbc_heightText.gridy = 1;
    contentPanel.add(heightText, gbc_heightText);
    heightText.setColumns(10);
  }
Exemplo n.º 11
0
 public SpeedSliderPanel(GUIWorkspace workspace, boolean labelsBelow) {
   this.workspace = workspace;
   this.labelsBelow = labelsBelow;
   speedSlider = new SpeedSlider((int) workspace.speedSliderPosition());
   speedSlider.setFocusable(false);
   speedSlider.addChangeListener(this);
   speedSlider.addMouseListener(this);
   speedSlider.setOpaque(false);
   org.nlogo.awt.Fonts.adjustDefaultFont(normal);
   setOpaque(false);
   if (labelsBelow) {
     GridBagLayout gridbag = new GridBagLayout();
     GridBagConstraints c = new GridBagConstraints();
     setLayout(gridbag);
     c.gridwidth = GridBagConstraints.REMAINDER;
     add(speedSlider, c);
     c.gridwidth = 1;
     c.anchor = GridBagConstraints.CENTER;
     add(normal, c);
   } else {
     java.awt.BorderLayout layout = new java.awt.BorderLayout();
     layout.setVgap(0);
     setLayout(layout);
     add(speedSlider, java.awt.BorderLayout.CENTER);
     add(normal, java.awt.BorderLayout.EAST);
   }
   enableLabels(0);
 }
Exemplo n.º 12
0
  AboutDialog(JFrame parent) {
    super(parent, "About this program", true);
    setSize(380, 300);
    setLocation(50, 50);
    setResizable(false);
    LayoutManager layout = new GridBagLayout();
    setLayout(layout);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets.left = 60;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    add(new JLabel("distributed.net Log Visualizer v1.6"), gbc);
    add(new JLabel("programmed by:"), gbc);
    add(new JLabel("  Jeff \"Bovine\" Lawson <*****@*****.**>"), gbc);
    add(new JLabel("  William Goo <*****@*****.**>"), gbc);
    add(new JLabel("  Yves Hetzer <*****@*****.**>"), gbc);
    add(new JLabel("  Greg Hewgill <*****@*****.**>"), gbc);
    add(new JLabel("  Jason Townsend <*****@*****.**>"), gbc);
    add(new JLabel("  Andy Hedges <*****@*****.**>"), gbc);
    add(new JLabel("  Stanley Appel <*****@*****.**>"), gbc);
    add(new JLabel(), gbc);
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.NONE;
    add(new OKButton(), gbc);

    URL res = getClass().getResource("cowhead.gif");
    if (res != null) {
      Cow = getToolkit().getImage(res);
    }
  }
  private void builder() {

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;

    ArrayList<Field> fields = batchState.getFields();

    for (int i = 0; i < batchState.getFields().size(); ++i) {
      TextBox temp = new TextBox(i + 1);
      textBoxes.add(temp);

      gbc.gridy++;
      textBoxes.get(i).fieldTitle.setText(fields.get(i).getTitle() + " :");
      //			addListener(textBoxes.get(i));
      formText.add(textBoxes.get(i), gbc);

      gbc.gridy++;
      formText.add(new JPanel(), gbc);
    }
    for (int i = 0; i < batchState.getProject().getRecordsPerBatch(); ++i) {
      dlm.addElement(i + 1);
    }
    indexedData = new String[fields.size()][batchState.getProject().getRecordsPerBatch()];
    initializeData();
  }
Exemplo n.º 14
0
  private void buildGUI() {
    // add all page components to grid layout panel
    pagesPanel = new JPanel();
    pagesPanel.setBackground(backgroundColor);
    // one column equals single page view continuous
    GridLayout gridLayout = new GridLayout(0, 1, horizontalSpace, verticalSpace);
    pagesPanel.setLayout(gridLayout);

    // use a grid bag to center the page component panel
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weighty = 1.0; // allows vertical resizing
    gbc.weightx = 1.0; // allows horizontal resizing
    gbc.insets = // component spacer [top, left, bottom, right]
        new Insets(layoutInserts, layoutInserts, layoutInserts, layoutInserts);
    gbc.gridwidth = GridBagConstraints.REMAINDER; // one component per row

    this.setLayout(new GridBagLayout());
    this.add(pagesPanel, gbc);

    // finally add all the components
    // add components for every page in the document
    List<AbstractPageViewComponent> pageComponents = documentViewModel.getPageComponents();

    if (pageComponents != null) {
      for (PageViewComponent pageViewComponent : pageComponents) {
        if (pageViewComponent != null) {
          pageViewComponent.setDocumentViewCallback(this);
          // add component to layout
          pagesPanel.add(new PageViewDecorator((AbstractPageViewComponent) pageViewComponent));
        }
      }
    }
  }
Exemplo n.º 15
0
 /**
  * Adds a label that shows the percentage of hours spent on a particular project.
  *
  * @param gbl The layout to add the label to.
  * @param gbc The layout constraints to use.
  * @param row The row to link against.
  * @see {@link #addRow(GridBagLayout, GridBagConstraints, String, double)}
  */
 private void addPercentLabel(GridBagLayout gbl, GridBagConstraints gbc, Row row) {
   gbc.gridx = 3;
   gbc.ipadx = 5;
   gbl.setConstraints(row.percentL, gbc);
   gbc.ipadx = 0;
   reviewPanel.add(row.percentL);
 }
Exemplo n.º 16
0
  public LogFilesTab() {

    _localFileSystem
        .getFileTree()
        .getSelectionModel()
        .addListSelectionListener(new LogSelectionListener(_localFileSystem.getFileTree()));

    this.setLayout(new GridBagLayout());
    GridBagConstraints cons = new GridBagConstraints();

    this.addComponentListener(this);

    _outerSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

    _outerSplitPane.setLeftComponent(getLocalFileSystemPanel());
    _outerSplitPane.setRightComponent(_middlePanel);

    cons.fill = GridBagConstraints.BOTH;
    cons.weightx = 1.0;
    cons.weighty = 1.0;

    // same weight for each size
    _outerSplitPane.setResizeWeight(0.5);

    this.add(_outerSplitPane, cons);

    // makes each side with same desired size so that the split happens exactly in the middle
    this.getLocalFileSystemPanel().setPreferredSize(_middlePanel.getPreferredSize());
  }
Exemplo n.º 17
0
  /** 初始化面板布局 */
  private void initLayout() {
    GridBagConstraints c = new GridBagConstraints();
    GridBagLayout gridbag = new GridBagLayout();
    this.setLayout(gridbag);

    JPanel controlTopPanel = this.getControlTopPanel();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.8;
    c.anchor = GridBagConstraints.WEST;
    gridbag.setConstraints(controlTopPanel, c);
    this.add(controlTopPanel);

    JPanel controlBottomPanel = this.getControlBottomPanel();
    c.gridy = GridBagConstraints.RELATIVE;
    gridbag.setConstraints(controlBottomPanel, c);
    this.add(controlBottomPanel);

    JButton comboButton = this.comboButton;
    comboButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            combo();
          }
        });

    c.gridx = GridBagConstraints.RELATIVE;
    c.gridheight = 2;
    c.weightx = 0.2;
    c.fill = GridBagConstraints.BOTH;
    gridbag.setConstraints(comboButton, c);
    this.add(comboButton);
  }
  public ActionPanel(String text, int nb, MouseListener ml) {
    this.setNb(nb);
    this.text = text;
    this.addMouseListener(ml);
    this.font = new Font("sans-serif", Font.PLAIN, 12);
    this.selected = false;
    this.setBackground(new Color(122, 197, 255));
    this.setPreferredSize(new Dimension(200, 20));
    this.setBorder(BorderFactory.createRaisedBevelBorder());
    this.setPreferredSize(new Dimension(200, 20));
    createImages();
    this.setRequestFocusEnabled(true);

    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 0, 0, 40, 0};
    gridBagLayout.rowHeights = new int[] {0, 0};
    gridBagLayout.columnWeights = new double[] {0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {0.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);

    JLabel lblNewLabel = new JLabel("(" + String.valueOf(nb) + ")");
    lblNewLabel.setForeground(Color.GRAY);
    lblNewLabel.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
    GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
    gbc_lblNewLabel.gridx = 3;
    gbc_lblNewLabel.gridy = 0;
    add(lblNewLabel, gbc_lblNewLabel);
  }
Exemplo n.º 19
0
 /** Lay out the elements for the main window */
 protected void buildFrame() {
   GridBagConstraints c = new GridBagConstraints();
   GridBagLayout layout = new GridBagLayout();
   frame = new JFrame();
   menuBar = frame.getJMenuBar();
   if (menuBar == null) {
     menuBar = new JMenuBar();
     frame.setJMenuBar(menuBar);
   }
   basicListener = new BasicListener();
   JMenu menu = new JMenu("File");
   JMenuItem readDirectory = new JMenuItem("Read Directory");
   readDirectory.addActionListener(basicListener);
   readDirectory.setActionCommand("READALL");
   menu.add(readDirectory);
   JMenuItem exitProgram = new JMenuItem("ExitProgram");
   exitProgram.addActionListener(basicListener);
   exitProgram.setActionCommand("EXIT");
   menu.add(exitProgram);
   menuBar.add(menu);
   JPanel panel = new JPanel();
   c.fill = GridBagConstraints.BOTH;
   c.gridwidth = GridBagConstraints.REMAINDER;
   c.weightx = 3.0f;
   panel.setLayout(layout);
   extraButtonItems(panel, layout);
   c.weighty = 2.0f;
   layout.setConstraints(panel, c);
   frame.add(panel);
   frame.setSize(400, 400);
   frame.setVisible(true);
 }
  public PanellMonstres(FinestraPpal fin) {
    imgfons = new JLabel(new ImageIcon("fons_1.png"));

    imgfons.setLocation(0, 0);
    imgfons.setSize(390, 540);
    imgfons.setVisible(true);

    finestra = fin;
    setLayout(new GridBagLayout());
    propsLay = new GridBagConstraints();
    propsLay.gridx = 0;
    propsLay.gridy = 0;
    propsLay.fill = GridBagConstraints.BOTH;
    propsLay.weightx = 1.0;
    propsLay.weighty = 1.0;
    this.add(imgfons, propsLay);

    // this.add(imgfons, propsLay);
    // Fixem tamany finestra
    setSize(390, 540);
    // this.setBackground(Color.YELLOW);
    fin.setContentPane(this);
    this.setLocation(0, 0);
    // Fixem tamany finestra
    fin.setSize(390, 540);
    fin.setVisible(true);
  }
Exemplo n.º 21
0
  LoginFrame(String name, String dbhost, String dbname, String tbname) {
    gb = new GridBagLayout();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    this.setLayout(gb);
    this.setTitle(name);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.content = (JPanel) this.getContentPane();
    this.host = new JTextField(20);
    this.database = new JTextField(20);
    this.username = new JTextField(20);
    this.password = new JPasswordField(20);
    this.table = new JTextField(20);
    this.login = new JButton("Login");
    this.exit = new JButton("Exit");

    this.host.setText(dbhost);
    this.host.setEditable(false);
    this.database.setText(dbname);
    this.database.setEditable(false);
    this.table.setText(tbname);
    this.table.setEditable(false);
    this.addFields();
    this.requestFocus();
    this.username.requestFocusInWindow();
    this.pack();
    this.setLocationRelativeTo(null);
  }
Exemplo n.º 22
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    // Ventana principal
    frmVisualizadord = new JFrame();
    frmVisualizadord.setIconImage(
        Toolkit.getDefaultToolkit().getImage(Visualizador3D.class.getResource("/icon/icon.png")));
    frmVisualizadord.setTitle("Visualizador 3D");
    frmVisualizadord.setBounds(50, 20, 1200, 700);
    frmVisualizadord.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 200, 0};
    gridBagLayout.rowHeights = new int[] {261, 0};
    gridBagLayout.columnWeights = new double[] {1.0, 0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {1.0, Double.MIN_VALUE};
    frmVisualizadord.getContentPane().setLayout(gridBagLayout);

    // Panel Imagen
    panelImagen = new Imagen3D();

    GridBagConstraints gbc_panelImagen = new GridBagConstraints();
    gbc_panelImagen.fill = GridBagConstraints.BOTH;
    gbc_panelImagen.insets = new Insets(15, 15, 15, 5);
    gbc_panelImagen.gridx = 0;
    gbc_panelImagen.gridy = 0;
    frmVisualizadord.getContentPane().add(panelImagen, gbc_panelImagen);

    // Cargar Handler
    MouseHandler mouseHandler = new MouseHandler(this, panelImagen);

    // Panel Opciones
    panelOpciones = new JPanel();

    GridBagConstraints gbc_panelOpciones = new GridBagConstraints();
    gbc_panelOpciones.insets = new Insets(15, 10, 15, 15);
    gbc_panelOpciones.fill = GridBagConstraints.BOTH;
    gbc_panelOpciones.gridx = 1;
    gbc_panelOpciones.gridy = 0;
    frmVisualizadord.getContentPane().add(panelOpciones, gbc_panelOpciones);

    GridBagLayout gbl_panelOpciones = new GridBagLayout();
    gbl_panelOpciones.columnWidths = new int[] {48, 0};
    gbl_panelOpciones.rowHeights = new int[] {36, 0, 0, 0, 0, 0, 0};
    gbl_panelOpciones.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gbl_panelOpciones.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    panelOpciones.setLayout(gbl_panelOpciones);

    initMenu();

    initPanelObjeto();

    initPanelLuzAmbiente();

    initPanelAmbienteColor();

    initPanelVisualizacion();

    initPanelTransformacion();

    initPanelPosicion();
  }
  private void setActiveArgumentPanel(ArgumentPanel newArgumentPanel) {
    JPanel oldActiveArgumentPanel = this.activeArgumentPanel;

    if (newArgumentPanel == oldActiveArgumentPanel) return;

    this.activeArgumentPanel = newArgumentPanel;

    if (oldActiveArgumentPanel != null) this.emptyPanel.remove(oldActiveArgumentPanel);

    GridBagConstraints constraints = new GridBagConstraints();
    this.emptyPanel.setLayout(new GridBagLayout());

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.insets = new Insets(0, 5, 0, 5);
    this.emptyPanel.add(this.activeArgumentPanel, constraints);

    revalidate();
    repaint();
  }
Exemplo n.º 24
0
  private void updateDebugPanelState(String result, boolean debug, boolean test) {
    result = result == null ? "nothing" : result;

    List<Component> componentList = Arrays.asList(getComponents());
    if (!componentList.contains(p_debug)) {

      choice = new Label(String.format("Your choice is: %s", result));
      isDebug = new Label(String.format("Debug mode: %b", debug));
      isTest = new Label(String.format("Test mode: %b", test));
      GridBagLayout layout = new GridBagLayout();
      GridBagConstraints constraints = new GridBagConstraints();
      layout.setConstraints(choice, constraints);
      constraints.gridy = 1;
      layout.setConstraints(isDebug, constraints);
      constraints.gridy = 2;
      layout.setConstraints(isTest, constraints);

      p_debug.setLayout(layout);
      p_debug.add(choice);
      p_debug.add(isDebug);
      p_debug.add(isTest);
      add(p_debug, BorderLayout.SOUTH);

    } else {
      choice.setText(String.format("Your choice is: %s", result));
      isDebug.setText(String.format("Debug mode: %b", debug));
      isTest.setText(String.format("Test mode: %b", test));
    }
  }
  private void initializeLayout() {
    this.setBorder(
        BorderFactory.createCompoundBorder(
            buildTitledBorder("PRIMARY_KEYS_PANEL.TITLE"),
            BorderFactory.createEmptyBorder(0, 5, 5, 5)));

    GridBagConstraints constraints = new GridBagConstraints();

    // primary keys - add/remove list panel
    AddRemoveListPanel pane = this.buildPrimaryKeysList();

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

    addHelpTopicId(this, this.helpTopicId());
  }
Exemplo n.º 26
0
  /**
   * allows easy adding of components to a container
   *
   * @param container where to add the component
   * @param comp component to add
   * @param x x-coordinate to add component
   * @param y y-coordinate to add component
   * @param width width of component
   * @param height height of component
   * @param weightx extra horizontal space to give to this component
   * @param weighty extra vertical space to give to this component
   * @param anchor where to align component if it is too small
   * @param fill how to stretch component if it is too small
   */
  public static void addComp(
      JPanel container,
      JComponent comp,
      int x,
      int y,
      int width,
      int height,
      int weightx,
      int weighty,
      int anchor,
      int fill) {
    // creates new constraints
    GridBagConstraints gc = new GridBagConstraints();

    // sets values
    gc.gridx = x;
    gc.gridy = y;
    gc.gridwidth = width;
    gc.gridheight = height;
    gc.weightx = weightx;
    gc.weighty = weighty;
    gc.insets = new Insets(1, 1, 1, 1);
    gc.anchor = anchor;
    gc.fill = fill;

    // adds component to container
    container.add(comp, gc);
  }
Exemplo n.º 27
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
Exemplo n.º 28
0
  public NotificacioGenerica(String missatge) {
    frame = new JFrame("Notificació");
    frame.getContentPane().setLayout(new GridBagLayout());
    label = new JTextArea(missatge);
    label.setEnabled(false);
    label.setEditable(false);
    button = new JButton("D'acord!");
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    frame.getContentPane().add(label, c);
    c.gridy = 1;
    frame.getContentPane().add(button, c);
    button.requestFocusInWindow();

    button.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            frame.dispose();
          }
        });

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    pack();
    mostra(true);
  }
Exemplo n.º 29
0
 /** Add a component to the Dialog. */
 public void addComponent(JComponent component) {
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = gbc.BOTH;
   gbc.gridwidth = gbc.REMAINDER;
   gbc.weightx = gbc.weighty = 1;
   add(component, gbc);
 }
  private JPanel createParallelGenerationGroup() {
    JPanel parallelGen = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridy = 0;
    parallelGen.add(myUseNewGenerator, c);
    final ChangeListener listener =
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            myUseNewGenerator.setEnabled(myStrictMode.isSelected());
            myNumberOfParallelThreads.setEditable(
                myUseNewGenerator.isSelected() && myStrictMode.isSelected());
          }
        };
    myStrictMode.addChangeListener(listener);
    myUseNewGenerator.addChangeListener(listener);
    c.insets.left = 7;
    parallelGen.add(new JLabel("Use"), c);
    c.insets.left = 3;
    myNumberOfParallelThreads.setColumns(2);
    parallelGen.add(myNumberOfParallelThreads, c);
    c.insets.left = 2;
    parallelGen.add(new JLabel("cores"), c);
    c.weightx = 1;
    parallelGen.add(new JPanel(), c);

    parallelGen.setToolTipText(
        String.format(
            "This computer has %d processors", Runtime.getRuntime().availableProcessors()));

    myButtonState.track(myUseNewGenerator);

    return parallelGen;
  }