Exemplo n.º 1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
Exemplo n.º 2
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {30, 36, 353, 0};
    gridBagLayout.rowHeights = new int[] {30, 16, 0};
    gridBagLayout.columnWeights = new double[] {0.0, 0.0, 1.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    frame.getContentPane().setLayout(gridBagLayout);

    JLabel lblName = new JLabel("Name");
    GridBagConstraints gbc_lblName = new GridBagConstraints();
    gbc_lblName.insets = new Insets(0, 0, 0, 5);
    gbc_lblName.anchor = GridBagConstraints.EAST;
    gbc_lblName.gridx = 1;
    gbc_lblName.gridy = 1;
    frame.getContentPane().add(lblName, gbc_lblName);

    textField = new JTextField();
    GridBagConstraints gbc_textField = new GridBagConstraints();
    gbc_textField.anchor = GridBagConstraints.WEST;
    gbc_textField.gridx = 3;
    gbc_textField.gridy = 1;
    frame.getContentPane().add(textField, gbc_textField);
    textField.setColumns(10);
  }
    public void layoutConverters() {
      GridBagLayout gridbag = (GridBagLayout) getLayout();
      int x = 0;
      int y = 0;

      GridBagConstraints c = createConstraints(x, y++);
      ImageIcon icon = createImageIcon("images/lb.png", "EU");
      JLabel label = new JLabel(icon);
      gridbag.setConstraints(label, c);
      add(label);

      int ignore_metric = 0;
      for (WeightMultipliers wm : WeightMultipliers.values()) {
        /*
        values returns all enum values in order of declartion but we
        want to ingore the first 6 (metric) values.
        */
        if (ignore_metric > 5) {
          newTextPane(
              createConstraints(x, y++),
              gridbag,
              new DocumentPositiveNumberFilter(cValue, wm, frame),
              labels[ignore_metric - 6]);
        }
        ignore_metric++;
      }
      // FIXME: Is there a cleaner way to iterate over a chunk of what values() returns?
    }
Exemplo n.º 4
0
  private JPanel getMainPanel() {
    if (mainPanel == null) {
      mainPanel = new JPanel();
      mainPanel.setPreferredSize(new Dimension(550, 300));
      GridBagLayout layout = new GridBagLayout();

      mainPanel.setLayout(layout);

      GridBagConstraints constraints = new GridBagConstraints();

      constraints.fill = GridBagConstraints.BOTH;
      constraints.weightx = 2;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.gridwidth = 2;
      layout.setConstraints(getAvailableRobotsPanel(), constraints);
      mainPanel.add(getAvailableRobotsPanel());
      constraints.gridwidth = 1;
      constraints.weightx = 0;
      constraints.weighty = 0;
      constraints.anchor = GridBagConstraints.CENTER;
      layout.setConstraints(getButtonsPanel(), constraints);
      mainPanel.add(getButtonsPanel());
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      layout.setConstraints(getSelectedRobotsPanel(), constraints);
      mainPanel.add(getSelectedRobotsPanel());
    }
    return mainPanel;
  }
 /** 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);
 }
Exemplo n.º 6
0
    public void addRow(String label, JComponent component) {
      GridBagConstraints labelConstraints = new GridBagConstraints();
      labelConstraints.gridx = 0;
      labelConstraints.gridy = rowCount;
      labelConstraints.insets = new Insets(0, 0, 5, 5);
      labelConstraints.anchor = GridBagConstraints.LINE_END;

      GridBagConstraints componentConstraints = new GridBagConstraints();
      componentConstraints.gridx = 1;
      componentConstraints.gridy = rowCount;
      componentConstraints.gridwidth = GridBagConstraints.REMAINDER;
      componentConstraints.fill = GridBagConstraints.HORIZONTAL;
      componentConstraints.insets = new Insets(0, 0, 5, 0);
      componentConstraints.anchor = GridBagConstraints.LINE_START;

      JLabel l = new JLabel(label + ":");
      add(l, labelConstraints);
      add(component, componentConstraints);
      rowCount++;

      // Add another column/row that takes up all available space.
      // This moves the layout to the top-left corner.
      layout.columnWidths = new int[] {0, 0, 0};
      layout.columnWeights = new double[] {0.0, 0.0, 1.0E-4};
      layout.rowHeights = new int[rowCount + 1];
      layout.rowWeights = new double[rowCount + 1];
      layout.rowWeights[rowCount] = 1.0E-4;
    }
 protected LayoutManager createDetailPanelLayout() {
   GridBagLayout layout = new GridBagLayout();
   layout.addLayoutComponent(
       detailsScrollPane,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(6, 0, 0, 0),
           0,
           0));
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.anchor = GridBagConstraints.LINE_END;
   gbc.fill = GridBagConstraints.NONE;
   gbc.gridwidth = 1;
   gbc.gridx = 0;
   gbc.gridy = 1;
   gbc.weighty = 0.0;
   gbc.weightx = 1.0;
   gbc.insets = new Insets(6, 0, 6, 0);
   layout.addLayoutComponent(copyToClipboardButton, gbc);
   return layout;
 }
Exemplo n.º 8
0
 /**
  * Adds a popup menu.
  *
  * @param label the label
  * @param items the menu items
  * @param defaultItem the menu item initially selected
  */
 public void addChoice(String label, String[] items, String defaultItem) {
   String label2 = label;
   if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' ');
   Label theLabel = makeLabel(label2);
   c.gridx = 0;
   c.gridy = y;
   c.anchor = GridBagConstraints.EAST;
   c.gridwidth = 1;
   if (choice == null) {
     choice = new Vector(4);
     defaultChoiceIndexes = new Vector(4);
     c.insets = getInsets(5, 0, 5, 0);
   } else c.insets = getInsets(0, 0, 5, 0);
   grid.setConstraints(theLabel, c);
   add(theLabel);
   Choice thisChoice = new Choice();
   thisChoice.addKeyListener(this);
   thisChoice.addItemListener(this);
   for (int i = 0; i < items.length; i++) thisChoice.addItem(items[i]);
   if (defaultItem != null) thisChoice.select(defaultItem);
   else thisChoice.select(0);
   c.gridx = 1;
   c.gridy = y;
   c.anchor = GridBagConstraints.WEST;
   grid.setConstraints(thisChoice, c);
   add(thisChoice);
   choice.addElement(thisChoice);
   int index = thisChoice.getSelectedIndex();
   defaultChoiceIndexes.addElement(new Integer(index));
   if (Recorder.record || macro) saveLabel(thisChoice, label);
   y++;
 }
  public PanelCharacterCombat(int maxWidth, CombatTrackerUnit character, Boolean isSelected) {
    combatUnit = character;

    setBorder(new EmptyBorder(4, 4, 4, 4));
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {56, 64, 0};
    gridBagLayout.rowHeights = new int[] {14, 0};
    gridBagLayout.columnWeights = new double[] {1.0, 0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {1.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);
    JLabel lblName = new JLabel(getCharacter().getName(true));

    GridBagConstraints gbc_lblName = new GridBagConstraints();
    gbc_lblName.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblName.insets = new Insets(0, 0, 0, 5);
    gbc_lblName.gridx = 0;
    gbc_lblName.gridy = 0;
    this.add(lblName, gbc_lblName);

    JLabel lblInit = new JLabel(getCharacter().getInitiative() + "");
    GridBagConstraints gbc_lblInit = new GridBagConstraints();
    gbc_lblInit.anchor = GridBagConstraints.EAST;
    gbc_lblInit.gridx = 1;
    gbc_lblInit.gridy = 0;
    add(lblInit, gbc_lblInit);

    if (isSelected) {
      this.setBackground(Color.GREEN);
    } else {
      this.setBackground(UIManager.getColor("Panel.background"));
    }

    this.setPreferredSize(new Dimension(maxWidth, 30));
  }
  private void initializeLocalePanel() {
    localeP = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    localeP.setLayout(gbl);

    JLabel localeL = new JLabel("Locale of the application:");
    localeCh = new ChoiceString();
    localeCh.setItems(
        Constants.getSupportedLocales(null)); // TODO replace null with real RessourceBundle
    localeCh.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            onChange();
          }
        });
    localeL.setLabelFor(localeCh);

    // layout
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    gbl.setConstraints(localeL, gbc);
    localeP.add(localeL);
    // ----
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(0, DingsSwingConstants.SP_H_G, 0, 0);
    gbl.setConstraints(localeCh, gbc);
    localeP.add(localeCh);
  } // END private void initializeLocalePanel()
Exemplo n.º 11
0
  protected void createGraghTab() {
    JPanel plotPanel = new JPanel();
    add(plotPanel, "<html><div style='text-align: center;'>C<br>h<br>a<br>r<br>t</div></html>");

    GridBagLayout gbl_plotPanel = new GridBagLayout();
    gbl_plotPanel.columnWidths = new int[] {0};
    gbl_plotPanel.rowHeights = new int[] {0, 0};
    gbl_plotPanel.columnWeights = new double[] {1.0};
    gbl_plotPanel.rowWeights = new double[] {0.0, 1.0};
    plotPanel.setLayout(gbl_plotPanel);

    JPanel cntlPanel = new JPanel();
    GridBagConstraints gbl_ctrlPanel = new GridBagConstraints();
    gbl_ctrlPanel.insets = new Insets(3, 3, 3, 3);
    gbl_ctrlPanel.anchor = GridBagConstraints.NORTH;
    gbl_ctrlPanel.weightx = 1.0;
    gbl_ctrlPanel.fill = GridBagConstraints.HORIZONTAL;
    gbl_ctrlPanel.gridx = 0;
    gbl_ctrlPanel.gridy = 0;
    plotPanel.add(cntlPanel, gbl_ctrlPanel);

    GridBagLayout gbl_cntlPanel = new GridBagLayout();
    gbl_cntlPanel.columnWidths = new int[] {0, 0};
    gbl_cntlPanel.rowHeights = new int[] {0, 0};
    gbl_cntlPanel.columnWeights = new double[] {0.0, 1.0};
    gbl_cntlPanel.rowWeights = new double[] {0};
    cntlPanel.setLayout(gbl_cntlPanel);

    createChart(plotPanel, xAxisName, yAxisName);
  }
  private void initializeStatsOnQuitPanel() {
    statsP = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    statsP.setLayout(gbl);

    statsOnQuitCB = new JCheckBox("Save learning statistics on quit");
    statsOnQuitCB.setMnemonic(("S").charAt(0));
    statsOnQuitCB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            onChange();
          }
        });

    // layout
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbl.setConstraints(statsOnQuitCB, gbc);
    statsP.add(statsOnQuitCB);
  } // END private void initializeStatsOnQuitPanel()
  private void initializeLookAndFeelPanel() {
    lookAndFeelP = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    lookAndFeelP.setLayout(gbl);

    lookAndFeelCB = new JCheckBox("Use system specific look and feel");
    lookAndFeelCB.setMnemonic(("U").charAt(0));
    lookAndFeelCB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            onChange();
          }
        });

    // layout
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbl.setConstraints(lookAndFeelCB, gbc);
    lookAndFeelP.add(lookAndFeelCB);
  } // END private void initializeLookAndFeelPanel()
  private void initializeFileEncodingPanel() {
    fileEncodingP = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    fileEncodingP.setLayout(gbl);

    JLabel fileEncodingL = new JLabel("File encoding:");
    fileEncodingCB = new JComboBox(Preferences.FILE_ENCODINGS);
    fileEncodingCB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            onChange();
          }
        });
    fileEncodingL.setLabelFor(fileEncodingCB);

    // layout
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    gbl.setConstraints(fileEncodingL, gbc);
    fileEncodingP.add(fileEncodingL);
    // ----
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(0, DingsSwingConstants.SP_H_G, 0, 0);
    gbl.setConstraints(fileEncodingCB, gbc);
    fileEncodingP.add(fileEncodingCB);
  } // END private void initializeFileEncodingPanel()
Exemplo n.º 15
0
  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);
  }
Exemplo n.º 16
0
  public ManageBankView() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 0, 0, 0, 0};
    gridBagLayout.rowHeights = new int[] {0, 0, 0, 0, 0};
    gridBagLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    getContentPane().setLayout(gridBagLayout);

    JLabel lblEnterBank = new JLabel("Enter Bank");
    GridBagConstraints gbc_lblEnterBank = new GridBagConstraints();
    gbc_lblEnterBank.insets = new Insets(0, 0, 5, 5);
    gbc_lblEnterBank.gridx = 1;
    gbc_lblEnterBank.gridy = 1;
    getContentPane().add(lblEnterBank, gbc_lblEnterBank);

    txtBankName = new JTextField();
    GridBagConstraints gbc_txtBankName = new GridBagConstraints();
    gbc_txtBankName.insets = new Insets(0, 0, 5, 0);
    gbc_txtBankName.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtBankName.gridx = 3;
    gbc_txtBankName.gridy = 1;
    getContentPane().add(txtBankName, gbc_txtBankName);
    txtBankName.setColumns(10);

    JButton btnAdd = new JButton("Add");
    GridBagConstraints gbc_btnAdd = new GridBagConstraints();
    gbc_btnAdd.insets = new Insets(0, 0, 0, 5);
    gbc_btnAdd.gridx = 1;
    gbc_btnAdd.gridy = 3;
    getContentPane().add(btnAdd, gbc_btnAdd);
  }
Exemplo n.º 17
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));
    }
  }
Exemplo n.º 18
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.º 19
0
  public MessageDialog(String message, Dialog owner) {
    super(owner);

    // WindowClosw時にリソースを開放してダイアログを閉じる
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            dispose();
          }
        });

    setTitle("MessageDialog");

    setBounds(200, 200, 0, 0);
    setLayout(gbl);

    // (0, 0) 幅=50, 高さ=1
    Label label = new Label(message);
    gbl.setConstraints(label, MainFrame.setGBC(0, 0, 50, 1));
    add(label);

    // (0, 1) 幅=50, 高さ=1
    Button ok_btn = new Button("OK");
    gbl.setConstraints(ok_btn, MainFrame.setGBC(0, 1, 50, 1));
    add(ok_btn);

    ok_btn.addActionListener(this);

    pack();
    setModal(true);
    setVisible(true);
  }
Exemplo n.º 20
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.º 21
0
  /** initialization of graphical components */
  public JMainWinView() {

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setBounds(200, 200, 800, 600);

    /** initialization jContentPanel */
    jContentPanel = new JPanel();
    jContentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    GridBagLayout gbl_jContentPanel = new GridBagLayout();
    gbl_jContentPanel.columnWeights = new double[] {1.0, 0.0};
    gbl_jContentPanel.rowWeights = new double[] {0.0, 1.0};
    jContentPanel.setLayout(gbl_jContentPanel);
    setContentPane(jContentPanel);

    /** initialization jMainMenu */
    jMainMenu = new JMainMenuView();
    GridBagConstraints gbc_jMainMenu = new GridBagConstraints();
    gbc_jMainMenu.anchor = GridBagConstraints.NORTH;
    gbc_jMainMenu.insets = new Insets(0, 0, 0, 0);
    gbc_jMainMenu.fill = GridBagConstraints.HORIZONTAL;
    gbc_jMainMenu.gridx = 0;
    gbc_jMainMenu.gridy = 0;
    gbc_jMainMenu.gridwidth = 2;
    jContentPanel.add(jMainMenu, gbc_jMainMenu);

    /** initialization jPanelFiles */
    jPanelFiles = new JPanelFiles();
    GridBagConstraints gbc_jPanelFiles = new GridBagConstraints();
    gbc_jPanelFiles.anchor = GridBagConstraints.NORTH;
    gbc_jPanelFiles.insets = new Insets(0, 0, 0, 0);
    gbc_jPanelFiles.fill = GridBagConstraints.HORIZONTAL;
    gbc_jPanelFiles.gridx = 0;
    gbc_jPanelFiles.gridy = 1;
    jContentPanel.add(jPanelFiles, gbc_jPanelFiles);
  }
Exemplo n.º 22
0
 public Main() {
   setIconImage(
       Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/img/multimedia-5.png")));
   setTitle("CATALOG2");
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setBounds(100, 100, 800, 600);
   setJMenuBar(getMenuBar_1());
   contentPane = new JPanel();
   contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
   setContentPane(contentPane);
   GridBagLayout gbl_contentPane = new GridBagLayout();
   gbl_contentPane.columnWidths = new int[] {400, 400, 0};
   gbl_contentPane.rowHeights = new int[] {0, 0};
   gbl_contentPane.columnWeights = new double[] {1.0, 1.0, Double.MIN_VALUE};
   gbl_contentPane.rowWeights = new double[] {1.0, Double.MIN_VALUE};
   contentPane.setLayout(gbl_contentPane);
   GridBagConstraints gbc_scrollPane = new GridBagConstraints();
   gbc_scrollPane.fill = GridBagConstraints.BOTH;
   gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
   gbc_scrollPane.gridx = 0;
   gbc_scrollPane.gridy = 0;
   contentPane.add(getScrollPane(), gbc_scrollPane);
   GridBagConstraints gbc_scrollPane_2 = new GridBagConstraints();
   gbc_scrollPane_2.fill = GridBagConstraints.BOTH;
   gbc_scrollPane_2.gridx = 1;
   gbc_scrollPane_2.gridy = 0;
   contentPane.add(getScrollPane_2(), gbc_scrollPane_2);
 }
Exemplo n.º 23
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.º 25
0
  void buildLayout() {
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    panel.setLayout(layout);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.insets.top = 50;
    constraints.insets.bottom = 0;
    constraints.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(loginPanel, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.insets.top = 0;
    constraints.insets.bottom = 15;
    constraints.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(lblWashU, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.insets.top = 0;
    constraints.insets.bottom = 10;
    constraints.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(lblHost, constraints);
  }
Exemplo n.º 26
0
  /**
   * Creates a new NewStringPopupDialog object.
   *
   * @param parent DOCUMENT ME!
   * @param title DOCUMENT ME!
   */
  public NewStringPopupDialog(Frame parent, String title) {
    super(parent, true);
    setTitle(title);
    textField = new JTextField();
    textField.setPreferredSize(new Dimension(200, 25));
    theString = null;

    JButton okButton = new JButton("OK");
    JButton cancelButton = new JButton("Cancel");
    okButton.addActionListener(new OkAction());
    cancelButton.addActionListener(new CancelAction());

    JPanel panel = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    panel.setLayout(gridbag);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    gridbag.setConstraints(textField, c);
    panel.add(textField);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    gridbag.setConstraints(okButton, c);
    panel.add(okButton);
    c.gridx = 1;
    c.gridy = 1;
    gridbag.setConstraints(cancelButton, c);
    panel.add(cancelButton);
    setContentPane(panel);
    pack();
    setLocationRelativeTo(parent);
    setVisible(true);
  }
    public void layoutConverters() {
      GridBagLayout gridbag = (GridBagLayout) getLayout();
      int x = 0;
      int y = 0;

      GridBagConstraints c = createConstraints(x, y++);
      ImageIcon icon = createImageIcon("images/kg.png", "EU");
      JLabel label = new JLabel(icon);
      gridbag.setConstraints(label, c);
      add(label);

      int just_metric = 0;
      for (WeightMultipliers wm : WeightMultipliers.values()) {
        if (just_metric > 5) {
          return;
        }

        newTextPane(
            createConstraints(x, y++),
            gridbag,
            new DocumentPositiveNumberFilter(cValue, wm, frame),
            labels[just_metric]);
        just_metric++;
      }
    }
Exemplo n.º 28
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();
  }
Exemplo n.º 29
0
  public DialogBox(Frame parent, String frametitle, String line1, String line2) {
    super(parent, frametitle, true);

    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gb);

    // line 1
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    Label line1Label = new Label(line1, Label.CENTER);
    gb.setConstraints(line1Label, c);
    line1Label.setForeground(Color.blue);
    line1Label.setFont(new Font("arial", Font.BOLD | Font.ITALIC, 16));
    add(line1Label);

    // line 2
    c.gridy = 1;
    Label line2Label = new Label(line2, Label.CENTER);
    gb.setConstraints(line2Label, c);
    add(line2Label);

    // Button
    c.gridy = 2;
    c.fill = GridBagConstraints.NONE;
    Button okButton = new Button("OK");
    gb.setConstraints(okButton, c);
    okButton.addActionListener(this);
    add(okButton);

    setLocation(400, 200);
    pack();
    setVisible(true);
    toFront();
  }
Exemplo n.º 30
0
  private void createCellType_2() {
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 1;
    gbConstraints.gridwidth = 1;
    gbConstraints.gridheight = 1;
    gbConstraints.fill = GridBagConstraints.BOTH;
    gbConstraints.weightx = 1;
    gbConstraints.weighty = 0;
    gbConstraints.anchor = GridBagConstraints.NORTH;
    gbConstraints.insets = new Insets(1, 1, 1, 1);
    gbLayout.setConstraints((JTextField) al.get(0), gbConstraints);
    add((JTextField) al.get(0));

    gbConstraints.gridx = 0;
    gbConstraints.gridy = 2;
    gbConstraints.gridwidth = 1;
    gbConstraints.gridheight = 1;
    gbConstraints.fill = GridBagConstraints.BOTH;
    gbConstraints.weightx = 1;
    gbConstraints.weighty = 0;
    gbConstraints.anchor = GridBagConstraints.NORTH;
    gbConstraints.insets = new Insets(1, 1, 1, 1);
    gbLayout.setConstraints((JTextField) al.get(1), gbConstraints);
    add((JTextField) al.get(1));
  }