示例#1
0
  /**
   * Loads the tileset defined in the constructor into a JPanel which it then returns. Makes no
   * assumptions about height or width, which means it needs to read an extra 64 tiles at worst (32
   * down to check height and 32 across for width), since the maximum height/width is 32 tiles.
   */
  public JPanel loadTileset() {
    int height = MAX_TILESET_SIZE;
    int width = MAX_TILESET_SIZE;

    boolean maxHeight = false;
    boolean maxWidth = false;

    // find width
    int j = 0;
    while (!maxWidth) {
      try {
        File f = new File(tileDir + "/" + j + "_" + 0 + ".png");
        ImageIO.read(f);
      } catch (IOException e) {
        width = j;
        maxWidth = true;
      }
      j += TILE_SIZE;
    }

    // find height
    int i = 0;
    while (!maxHeight) {
      try {
        File f = new File(tileDir + "/" + 0 + "_" + i + ".png");
        ImageIO.read(f);
      } catch (IOException e) {
        height = i;
        maxHeight = true;
      }
      i += TILE_SIZE;
    }

    JPanel tileDisplay = new JPanel();
    tileDisplay.setLayout(new GridLayout(height / TILE_SIZE, width / TILE_SIZE));
    tileDisplay.setMinimumSize(new Dimension(width, height));
    tileDisplay.setPreferredSize(new Dimension(width, height));
    tileDisplay.setMaximumSize(new Dimension(width, height));

    for (i = 0; i < height; i += TILE_SIZE) {
      for (j = 0; j < width; j += TILE_SIZE) {
        String fPath = tileDir + "/" + j + "_" + i;
        try {
          int[] mov = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};

          Image icon = getTile(tileDir, j, i, 1);
          Tile tile =
              new Tile(new ImageIcon(icon), "palette", 0, 0, mov, "none", false, "" + j + "_" + i);
          tile.addMouseListener(new PaletteButtonListener());
          tile.setMaximumSize(new Dimension(TILE_SIZE, TILE_SIZE));
          tile.setPreferredSize(new Dimension(TILE_SIZE, TILE_SIZE));
          tile.setMinimumSize(new Dimension(TILE_SIZE, TILE_SIZE));
          tileDisplay.add(tile);
        } catch (IOException e) {
        }
      }
    }
    return tileDisplay;
  }
 private void syncSizeToCertificateDetail() {
   if (usermessage != null) {
     usermessage.setPreferredSize(cd.getPreferredSize());
     usermessage.setMinimumSize(cd.getMinimumSize());
   }
   detailPane.setPreferredSize(cd.getPreferredSize());
   detailPane.setMinimumSize(cd.getMinimumSize());
 }
  public void createPanel3() {
    panel3 = new JPanel();
    panel3.setLayout(new BorderLayout());
    panel3.setPreferredSize(new Dimension(400, 100));
    panel3.setMinimumSize(new Dimension(100, 50));

    panel3.add(new JLabel("Notes:"), BorderLayout.NORTH);
    panel3.add(new JTextArea(), BorderLayout.CENTER);
  }
示例#4
0
  public SwingPathsPanel() {
    super();
    this.setLayout(new MigLayout());
    this.setOpaque(false);
    this.removeAll();
    JPanel patternBox = new JPanel(new MigLayout());
    patternBox.setOpaque(false);
    patternBox.setMinimumSize(new Dimension(480, 366));
    TitledBorder border = new TitledBorder("Phrases");
    patternBox.setBorder(border);
    this.add(patternBox);
    JScrollPane scrollPane = new JScrollPane(textArea);
    textArea.setEditable(false);
    patternBox.add(scrollPane, "span");
    JButton allPatternsButton = new JButton("All phrases");
    JButton sententialPatternsButton = new JButton("Sentential phrases");

    patternBox.add(allPatternsButton);
    patternBox.add(sententialPatternsButton);

    // Box patternBox = Ice.selectedCorpus.swingPatternBox();
    // patternBox.setOpaque(false);
    // patternBox.setMinimumSize(new Dimension(480, 366));
    // this.add(patternBox);

    allPatternsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ProgressMonitorI progressMonitor =
                new SwingProgressMonitor(
                    Ice.mainFrame,
                    "Extracting relation phrases",
                    "Initializing Jet",
                    0,
                    Ice.selectedCorpus.numberOfDocs + 30);
            checkForAndFindRelations(progressMonitor, false);
          }
        });

    sententialPatternsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ProgressMonitorI progressMonitor =
                new SwingProgressMonitor(
                    Ice.mainFrame,
                    "Extracting relation phrases",
                    "Initializing Jet",
                    0,
                    Ice.selectedCorpus.numberOfDocs + 30);
            checkForAndFindRelations(progressMonitor, true);
          }
        });

    iceStatusPanel = new SwingIceStatusPanel();
    this.add(iceStatusPanel);
    fullRefresh();
  }
示例#5
0
  public UnitTestRunner() {
    mainPane = new JPanel(new GridBagLayout());
    mainPane.setMinimumSize(new Dimension(0, 0));
    mainPane.setPreferredSize(new Dimension(270, 200));
    minPane = new JPanel(new GridBagLayout());

    initComponents();

    addGrid(
        mainPane, toolbar, 0, 0, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);

    addGrid(
        mainPane,
        new JSeparator(),
        0,
        1,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);

    addGrid(
        mainPane, fCounterPanel, 0, 2, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.WEST);
    addGrid(
        mainPane,
        fProgressIndicator,
        0,
        3,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);

    addGrid(
        mainPane,
        new JSeparator(),
        0,
        5,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);
    addGrid(
        mainPane,
        new JLabel("Results:"),
        0,
        6,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);

    addGrid(mainPane, fTestViewTab, 0, 7, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);

    // _lineNoOfTest = new HashMap<String, Integer>();
  }
  private void createPropertiesPanel() {
    myPropertiesPanel = new JPanel(new BorderLayout());
    final JPanel emptyPanel = new JPanel();
    emptyPanel.setMinimumSize(JBUI.emptySize());
    emptyPanel.setPreferredSize(JBUI.emptySize());

    myPropertiesPanelWrapper = new JPanel(new CardLayout());
    myPropertiesPanel.setBorder(new CustomLineBorder(1, 0, 0, 0));
    myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel);
    myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel);
  }
  public JPanel createContentPane() {

    // We create a bottom JPanel to place everything on.
    JPanel totalGUI = new JPanel();

    // We set the layout of the main JPanel to be BoxLayout.
    // LINE_AXIS sets them left to right, PAGE_AXIS sets them
    // from top to bottom.
    totalGUI.setLayout(new BoxLayout(totalGUI, BoxLayout.LINE_AXIS));

    JPanel redPanel = new JPanel();
    redPanel.setBackground(Color.red);
    redPanel.setMinimumSize(new Dimension(50, 50));
    redPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(redPanel);

    // This is the first spacer. This creates a spacer 10px wide that
    // will never get bigger or smaller.
    totalGUI.add(Box.createRigidArea(new Dimension(10, 0)));

    JPanel yellowPanel = new JPanel();
    yellowPanel.setBackground(Color.yellow);
    yellowPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(yellowPanel);

    // This spacer takes any spare space and places it as part of the spacer
    // If you drag the window wider, the space will get wider.
    totalGUI.add(Box.createHorizontalGlue());

    JPanel greenPanel = new JPanel();
    greenPanel.setBackground(Color.green);
    greenPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(greenPanel);

    // This spacer is a custom spacer.
    // The minimum size acts like a rigid area that
    // will not get any smaller than 10 pixels on the x-axis (horizontal)
    // and not get any smaller than 50 pixels on the y axis (vertical).
    // The way the maximum size is set up means the spacer acts like glue
    // and will expand to fit the available space.

    Dimension minSize = new Dimension(10, 50);
    Dimension prefSize = new Dimension(10, 50);
    Dimension maxSize = new Dimension(Short.MAX_VALUE, 50);
    totalGUI.add(new Box.Filler(minSize, prefSize, maxSize));

    JPanel bluePanel = new JPanel();
    bluePanel.setBackground(Color.blue);
    bluePanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(bluePanel);

    totalGUI.setOpaque(true);
    return totalGUI;
  }
示例#8
0
  public void createviewPanel() {

    viewPanel = new JPanel();
    viewPanel.setLayout(new BorderLayout());
    // viewPanel.setPreferredSize( new Dimension(500,500 ));
    // viewPanel.setMinimumSize( new Dimension(100,50));
    // viewPanel.add( new JLabel("Notes:"),BorderLayout.NORTH );
    //		viewPanel.add( new JTextArea(), BorderLayout.CENTER );
    viewPanel.setPreferredSize(new Dimension(200, 520));
    viewPanel.setMinimumSize(new Dimension(100, 100));
    // Create columns
    CreateColumns(colcnt);
    CreateData(rowcnt, colcnt);
    setSize(300, 200);

    table =
        new JTable(dataValues, columnNames) {

          public boolean isCellEditable(int rowIndex, int vColIndex) {
            return false;
          }
        };

    table
        .getModel()
        .addTableModelListener(
            new TableModelListener() {

              public void tableChanged(TableModelEvent e) {
                System.out.println("........" + e);
              }
            });
    // table.setValueAt("1,2",0,0);

    System.out.println("Row   :" + rowcnt);
    System.out.println("Col  :" + colcnt);

    // Configure some of JTable's paramters
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);

    // Change the selection colour
    table.setSelectionForeground(Color.white);
    table.setSelectionBackground(Color.red);

    // Add the table to a scrolling pane
    scrollPaneTable = JTable.createScrollPaneForTable(table);
    viewPanel.add(scrollPaneTable, BorderLayout.CENTER);
    viewPanel.add(table, BorderLayout.CENTER);
  }
示例#9
0
  public DemoVisualizeR(Maze maze, RewardFunction ag) {
    frame = new JFrame();
    panel = new Canvas();
    this.ag = ag;
    this.agx = 0;
    this.agy = 0;
    this.maze = maze;

    panel.setMinimumSize(new Dimension(500, 500));
    frame.setMinimumSize(new Dimension(500, 500));
    frame.add(panel);
    frame.setVisible(true);
  }
示例#10
0
 public JPanel createPanel(final JTabbedPane tabbedPane) {
   JPanel p =
       new JPanel() {
         public void setVisible(boolean v) {
           super.setVisible(v);
           Model3d.this.univers.getCanvas().setVisible(v);
         }
       };
   p.setLayout(new BorderLayout());
   p.add(this.univers.getCanvas());
   p.setMinimumSize(new Dimension(0, 0));
   return p;
 }
示例#11
0
  private JPanel addMethodCombo() {
    JPanel methodPanel = new JPanel(new BorderLayout());
    JComboBox<RestRequestInterface.RequestMethod> methodComboBox =
        new JComboBox<RestRequestInterface.RequestMethod>(new RestRequestMethodModel(getRequest()));
    methodComboBox.setSelectedItem(getRequest().getMethod());

    JLabel methodLabel = new JLabel("Method");
    methodPanel.add(methodLabel, BorderLayout.NORTH);
    methodPanel.add(methodComboBox, BorderLayout.SOUTH);
    methodPanel.setMinimumSize(new Dimension(75, STANDARD_TOOLBAR_HEIGHT));
    // TODO: remove hard coded height adjustment
    methodPanel.setMaximumSize(new Dimension(75, STANDARD_TOOLBAR_HEIGHT + 10));
    return methodPanel;
  }
示例#12
0
  /**
   * @param wizardModel The overall wizard data model containing the aggregate information of all
   *     components in the wizard
   * @param isExiting True if the exit button should trigger an application shutdown
   * @param wizardParameter An optional parameter that can be referenced during construction
   * @param escapeIsCancel If true, ESC cancels the wizard, if false, it does nothing
   */
  protected AbstractWizard(
      M wizardModel, boolean isExiting, Optional wizardParameter, boolean escapeIsCancel) {

    Preconditions.checkNotNull(wizardModel, "'model' must be present");

    log.debug("Building wizard...");

    this.wizardModel = wizardModel;
    this.exiting = isExiting;
    this.wizardParameter = wizardParameter;

    // Subscribe to events
    ViewEvents.subscribe(this);
    CoreEvents.subscribe(this);

    // Optionally bind the ESC key to a Cancel event (escape to safety)
    if (escapeIsCancel) {
      wizardScreenHolder
          .getInputMap(JPanel.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
          .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "quit");
      wizardScreenHolder.getActionMap().put("quit", getCancelAction());
    }

    // TODO Bind the ENTER key to a Next/Finish/Apply event to speed up data entry through keyboard
    // wizardPanel.getInputMap(JPanel.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "next");
    // wizardPanel.getActionMap().put("next", getNextAction(null));

    log.debug("Populating view map and firing initial state view events...");

    // Populate based on the current locale
    populateWizardViewMap(wizardViewMap);

    // Once all the views are created allow events to occur
    for (Map.Entry<String, AbstractWizardPanelView> entry : wizardViewMap.entrySet()) {

      // Ensure the panel is in the correct starting state
      entry.getValue().fireInitialStateViewEvents();
    }

    wizardScreenHolder.setMinimumSize(
        new Dimension(MultiBitUI.WIZARD_MIN_WIDTH, MultiBitUI.WIZARD_MIN_HEIGHT));
    wizardScreenHolder.setPreferredSize(
        new Dimension(MultiBitUI.WIZARD_MIN_WIDTH, MultiBitUI.WIZARD_MIN_HEIGHT));
    wizardScreenHolder.setSize(
        new Dimension(MultiBitUI.WIZARD_MIN_WIDTH, MultiBitUI.WIZARD_MIN_HEIGHT));

    // Show the panel specified by the initial state
    show(wizardModel.getPanelName());
  }
示例#13
0
  private JPanel getButtonsPanel() {
    if (buttonsPanel == null) {
      buttonsPanel = new JPanel();
      buttonsPanel.setPreferredSize(new Dimension(100, 30));
      buttonsPanel.setLayout(new GridBagLayout());
      buttonsPanel.setMinimumSize(new Dimension(20, 20));
      buttonsPanel.setMaximumSize(new Dimension(1000, 30));

      GridBagConstraints constraintsOKButton = new GridBagConstraints();

      constraintsOKButton.gridx = 1;
      constraintsOKButton.gridy = 1;
      constraintsOKButton.ipadx = 34;
      constraintsOKButton.insets = new Insets(2, 173, 3, 168);
      getButtonsPanel().add(getOkButton(), constraintsOKButton);
    }
    return buttonsPanel;
  }
示例#14
0
 public void addRow(Component... components) {
   remove(puff);
   final JPanel row = new JPanel();
   row.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent event) {
           gui.notifyObserver("/use " + rows.indexOf(event.getSource()));
         }
       });
   row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
   // row.add(Box.createHorizontalStrut(3));
   row.setMinimumSize(new Dimension(10, 30));
   row.setMaximumSize(new Dimension(250, 30));
   for (Component component : components) {
     row.add(component);
   }
   JButton red = new JButton("x");
   red.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
           int deleted = rows.indexOf(row);
           gui.notifyObserver("/use " + deleted);
           gui.notifyObserver("/disconnect");
         }
       });
   red.setBackground(Color.PINK.darker());
   red.setForeground(Color.WHITE);
   row.add(Box.createHorizontalGlue());
   row.add(red);
   rows.add(row);
   Component strut = Box.createVerticalStrut(5);
   struts.add(strut);
   add(row);
   add(strut);
   add(puff);
   repaint();
   updateUI();
 }
 /**
  * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
  * call it in your code!
  *
  * @noinspection ALL
  */
 private void $$$setupUI$$$() {
   contentPane = new JPanel();
   contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
   contentPane.setMinimumSize(new Dimension(350, 280));
   contentPane.setPreferredSize(new Dimension(350, 280));
   final JPanel panel1 = new JPanel();
   panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
   contentPane.add(
       panel1,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer1 = new Spacer();
   panel1.add(
       spacer1,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   final JPanel panel2 = new JPanel();
   panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false));
   panel1.add(
       panel2,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   buttonOK = new JButton();
   buttonOK.setText("OK");
   panel2.add(
       buttonOK,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   buttonCancel = new JButton();
   buttonCancel.setText("Cancelar");
   panel2.add(
       buttonCancel,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JPanel panel3 = new JPanel();
   panel3.setLayout(new GridLayoutManager(7, 2, new Insets(0, 0, 0, 0), -1, -1));
   contentPane.add(
       panel3,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final JLabel label1 = new JLabel();
   label1.setText("Nome");
   panel3.add(
       label1,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer2 = new Spacer();
   panel3.add(
       spacer2,
       new GridConstraints(
           6,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_VERTICAL,
           1,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           null,
           null,
           0,
           false));
   txtNome = new JTextField();
   panel3.add(
       txtNome,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
   final JLabel label2 = new JLabel();
   label2.setText("CPF");
   panel3.add(
       label2,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   txtCpf = new JTextField();
   panel3.add(
       txtCpf,
       new GridConstraints(
           1,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
   final JLabel label3 = new JLabel();
   label3.setText("Endereco");
   panel3.add(
       label3,
       new GridConstraints(
           2,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   txtEndereco = new JTextField();
   panel3.add(
       txtEndereco,
       new GridConstraints(
           2,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
   final JLabel label4 = new JLabel();
   label4.setText("Telefone");
   panel3.add(
       label4,
       new GridConstraints(
           3,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label5 = new JLabel();
   label5.setText("Status");
   panel3.add(
       label5,
       new GridConstraints(
           5,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   cboxStatusCliente = new JComboBox();
   final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
   defaultComboBoxModel1.addElement("Inativo");
   defaultComboBoxModel1.addElement("Ativo");
   cboxStatusCliente.setModel(defaultComboBoxModel1);
   panel3.add(
       cboxStatusCliente,
       new GridConstraints(
           5,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label6 = new JLabel();
   label6.setText("E-mail");
   panel3.add(
       label6,
       new GridConstraints(
           4,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   txtEmail = new JTextField();
   panel3.add(
       txtEmail,
       new GridConstraints(
           4,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
   txtTelefone = new JTextField();
   panel3.add(
       txtTelefone,
       new GridConstraints(
           3,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
 }
  private void jbInit() throws Exception {
    panel1.setLayout(borderLayout1);
    jLabelSynapseType.setText("Synapse type:");
    jLabelDelay.setText("Internal delay:");
    jButtonOK.setText("OK");
    jButtonOK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButtonOK_actionPerformed(e);
          }
        });
    jButtonCancel.setText("Cancel");
    jButtonCancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButtonCancel_actionPerformed(e);
          }
        });
    jPanelMain.setLayout(gridBagLayout1);
    jButtonDelay.setText("...");
    jButtonDelay.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButtonDelay_actionPerformed(e);
          }
        });
    jTextFieldDelay.setEditable(false);
    jTextFieldDelay.setText("");
    panel1.setMaximumSize(new Dimension(400, 200));
    panel1.setMinimumSize(new Dimension(400, 200));
    panel1.setPreferredSize(new Dimension(400, 200));
    jLabelWeights.setText("Synaptic weights:");
    jButtonWeights.setText("...");
    jButtonWeights.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButtonWeights_actionPerformed(e);
          }
        });
    jTextFieldWeights.setEditable(false);
    jTextFieldWeights.setText("");
    jLabelThreshold.setText("Voltage threshold:");
    jTextFieldThreshold.setText("");
    getContentPane().add(panel1);
    panel1.add(jPanelMain, BorderLayout.CENTER);
    jPanelMain.add(
        jLabelSynapseType,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(6, 20, 6, 12),
            0,
            0));

    jPanelMain.add(
        jLabelDelay,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(6, 20, 6, 0),
            0,
            0));
    jPanelMain.add(
        jTextFieldDelay,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(6, 0, 6, 6),
            0,
            0));
    jPanelMain.add(
        jButtonDelay,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(0, 6, 0, 20),
            0,
            0));
    jPanelMain.add(
        jLabelWeights,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(6, 12, 6, 12),
            0,
            0));
    jPanelMain.add(
        jTextFieldWeights,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(6, 0, 6, 6),
            0,
            0));
    jPanelMain.add(
        jButtonWeights,
        new GridBagConstraints(
            2,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(6, 6, 6, 20),
            0,
            0));
    panel1.add(jPanelButtons, BorderLayout.SOUTH);
    jPanelButtons.add(jButtonOK, null);
    jPanelButtons.add(jButtonCancel, null);
    jPanelMain.add(
        jLabelThreshold,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(6, 12, 6, 12),
            0,
            0));
    jPanelMain.add(
        jTextFieldThreshold,
        new GridBagConstraints(
            1,
            3,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(6, 0, 6, 20),
            0,
            0));
    jPanelMain.add(
        jComboBoxSynapseType,
        new GridBagConstraints(
            1,
            0,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(6, 0, 6, 20),
            0,
            0));
  }
示例#17
0
  /**
   * The class constructor.
   *
   * @param owner the GuiKeyboardInstance class instance
   * @param space plugin dimension
   */
  public GUI(final ButtonGridInstance owner, final Dimension space) {
    this.owner = owner;

    final JButton buttons[] = new JButton[owner.NUMBER_OF_KEYS];
    panel = new JPanel();

    setLayout(new BorderLayout());

    int labelHeight;

    if (owner.getCaption().length() > 0) {
      JLabel label = new JLabel(owner.getCaption(), 0);
      add(label, BorderLayout.NORTH);
      labelHeight = (int) getPreferredSize().getHeight();
    } else {
      labelHeight = 0;
    }

    for (int i = 0; i < owner.NUMBER_OF_KEYS; i++) {
      buttons[i] = new JButton();
      String caption = owner.getButtonCaption(i);
      buttons[i].setText(caption);
      if ("".equalsIgnoreCase(caption)) {
        buttons[i].setEnabled(false);
        buttons[i].setVisible(false);
      } else {
        numberOfKeys = numberOfKeys + 1;
        buttons[i].setEnabled(true);
        buttons[i].setVisible(true);

        final JButton b = buttons[i];

        // final Border raisedBevelBorder = BorderFactory.createRaisedBevelBorder();
        // final Insets insets = raisedBevelBorder.getBorderInsets(buttons[i]);
        // final EmptyBorder emptyBorder = new EmptyBorder(insets);
        // b.setBorder(emptyBorder);
        // b.setOpaque(false);
        // b.setContentAreaFilled(false);

        if (owner.propBorderColor != USE_DEFAULT_COLOR)
          b.setBorder(
              BorderFactory.createLineBorder(
                  getColorProperty(owner.propBorderColor), owner.propBorderThickness));

        b.setFocusPainted(false);
        if (!("".equalsIgnoreCase(owner.getToolTip(i)))) b.setToolTipText(owner.getToolTip(i));

        if (owner.propBackgroundColor != USE_DEFAULT_COLOR)
          b.setBackground(getColorProperty(owner.propBackgroundColor));

        if (owner.propTextColor != USE_DEFAULT_COLOR)
          b.setForeground(getColorProperty(owner.propTextColor));

        if (owner.propSelectionFrameColor != USE_DEFAULT_COLOR) {
          b.getModel()
              .addChangeListener(
                  new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                      ButtonModel model = (ButtonModel) e.getSource();
                      if (model.isRollover()) {
                        // b.setBorder(raisedBevelBorder);
                        b.setBorder(
                            BorderFactory.createLineBorder(
                                getColorProperty(owner.propSelectionFrameColor),
                                owner.propSelectionFrameThickness));
                      } else {
                        // b.setBorder(emptyBorder);
                        b.setBorder(
                            BorderFactory.createLineBorder(
                                getColorProperty(owner.propBorderColor),
                                owner.propBorderThickness));
                      }
                    }
                  });
        }
      }

      final int y = i;

      buttons[i].addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              if (colSav == null) colSav = buttons[y].getBackground();
              if (owner.propSelectionFrameColor == USE_DEFAULT_COLOR)
                buttons[y].setBackground(Color.RED);
              else buttons[y].setBackground(getColorProperty(owner.propSelectionFrameColor));
              owner.etpKeyArray[y].raiseEvent();

              AstericsThreadPool.instance.execute(
                  new Runnable() {
                    public void run() {
                      try {
                        Thread.sleep(250);
                        buttons[y].setBackground(colSav);
                      } catch (InterruptedException e) {
                      }
                    }
                  });
            }
          });
    }

    if (numberOfKeys > 0) {

      Dimension buttonDimension;
      Dimension panelDimension;

      if (owner.propHorizontalOrientation == true) {
        buttonDimension = new Dimension(space.width / numberOfKeys, ((space.height - labelHeight)));

        panelDimension =
            new Dimension(numberOfKeys * buttonDimension.width, buttonDimension.height);
      } else {
        buttonDimension = new Dimension(space.width, ((space.height - labelHeight) / numberOfKeys));

        panelDimension = new Dimension(space.width, numberOfKeys * buttonDimension.height);
      }

      panel.setMaximumSize(panelDimension);
      panel.setPreferredSize(panelDimension);
      panel.setMinimumSize(panelDimension);
      panel.setVisible(true);

      if (owner.propHorizontalOrientation == true) {
        panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
      } else {
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
      }

      for (int i = 0; i < owner.NUMBER_OF_KEYS; i++) {
        buttons[i].setPreferredSize(buttonDimension);
        buttons[i].setMinimumSize(buttonDimension);
        buttons[i].setMaximumSize(buttonDimension);
        // panel.add(buttons[i]);
      }

      float maxFontSize = fontSizeMax;
      float maxFontSizeTable[] = new float[owner.NUMBER_OF_KEYS];

      Rectangle buttonRectangle = new Rectangle();

      for (int i = 0; i < owner.NUMBER_OF_KEYS; i++) {
        float fontSize = 0;
        boolean finish = false;
        maxFontSizeTable[i] = 0;
        if (owner.getButtonCaption(i).length() > 0) {
          do {

            fontSize = fontSize + fontIncrementStep;

            buttons[i].setMargin(new Insets(2, 2, 2, 2));

            Font font = buttons[i].getFont();
            font = font.deriveFont(fontSize);
            FontMetrics fontMetrics = buttons[i].getFontMetrics(font);
            Rectangle2D tmpFontSize =
                fontMetrics.getStringBounds(owner.getButtonCaption(i), buttons[i].getGraphics());

            Insets insets = buttons[i].getMargin();

            double height = tmpFontSize.getHeight();
            double width = tmpFontSize.getWidth();
            double buttonHeightSpace =
                buttonDimension.getHeight()
                    - (double) insets.bottom
                    - (double) insets.top
                    - verticalOffset;
            double buttonWidthSpace =
                buttonDimension.getWidth()
                    - (double) insets.left
                    - (double) insets.right
                    - horizontalOffset;

            if ((height >= buttonHeightSpace) || (width >= buttonWidthSpace)) {
              finish = true;
              maxFontSizeTable[i] = fontSize - 1;
            } else {

              if (fontSize > fontSizeMax) {
                finish = true;
                maxFontSizeTable[i] = fontSize;
              }
            }

          } while (!finish);
        }
      }

      for (int i = 0; i < owner.NUMBER_OF_KEYS; i++) {
        if ((maxFontSizeTable[i] > 0) && (maxFontSizeTable[i] < maxFontSize)) {
          maxFontSize = maxFontSizeTable[i];
        }
      }

      for (int i = 0; i < owner.NUMBER_OF_KEYS; i++) {
        Font font = buttons[i].getFont();
        font = font.deriveFont(maxFontSize);
        buttons[i].setFont(font);
      }
    }

    for (int i = 0; i < owner.NUMBER_OF_KEYS; i++) {
      panel.add(buttons[i]);
    }

    add(panel, BorderLayout.CENTER);
    setBorder(BorderFactory.createLineBorder(Color.BLACK));
  }
  /* Build up the GUI using Swing magic. Nothing very exciting here - the
  BagPanel class makes the code a bit cleaner/easier to read. */
  private void guiInit() throws Exception {
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setMinimumSize(new Dimension(500, 250));
    mainPanel.setPreferredSize(new Dimension(500, 300));

    /* The message area */
    JScrollPane mssgPanel = new JScrollPane();
    mssgPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    mssgPanel.setAutoscrolls(true);
    mssgArea = new JTextArea();
    mssgArea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 20));
    mainPanel.add(mssgPanel, BorderLayout.CENTER);
    mssgPanel.getViewport().add(mssgArea, null);

    /* The button area */
    BagPanel buttonPanel = new BagPanel();
    GridBagConstraints c = buttonPanel.c;

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = GridBagConstraints.REMAINDER;

    buttonPanel.makeLabel("Detection", JLabel.CENTER);
    c.gridwidth = GridBagConstraints.RELATIVE;
    detDarkCb = buttonPanel.makeCheckBox("Dark", true);
    c.gridwidth = GridBagConstraints.REMAINDER;
    detAccelCb = buttonPanel.makeCheckBox("Movement", false);
    buttonPanel.makeSeparator(SwingConstants.HORIZONTAL);

    buttonPanel.makeLabel("Theft Reports", JLabel.CENTER);
    c.gridwidth = GridBagConstraints.RELATIVE;
    repLedCb = buttonPanel.makeCheckBox("LED", true);
    c.gridwidth = GridBagConstraints.REMAINDER;
    repSirenCb = buttonPanel.makeCheckBox("Siren", false);
    c.gridwidth = GridBagConstraints.RELATIVE;
    repServerCb = buttonPanel.makeCheckBox("Server", false);
    c.gridwidth = GridBagConstraints.REMAINDER;
    repNeighboursCb = buttonPanel.makeCheckBox("Neighbours", false);
    buttonPanel.makeSeparator(SwingConstants.HORIZONTAL);

    buttonPanel.makeLabel("Interval", JLabel.CENTER);
    fieldInterval = buttonPanel.makeTextField(10, null);
    fieldInterval.setText(Integer.toString(Constants.DEFAULT_CHECK_INTERVAL));

    ActionListener settingsAction =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            updateSettings();
          }
        };
    buttonPanel.makeButton("Update", settingsAction);

    mainPanel.add(buttonPanel, BorderLayout.EAST);

    /* The frame part */
    frame = new JFrame("AntiTheft");
    frame.setSize(mainPanel.getPreferredSize());
    frame.getContentPane().add(mainPanel);
    frame.setVisible(true);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
  public ComputationsPanel(final UACalculator uacalc) {
    super(JSplitPane.VERTICAL_SPLIT);
    setOneTouchExpandable(true);
    Dimension minimumSize = new Dimension(100, 100);
    Dimension preferredSize = new Dimension(100, 400);

    this.uacalc = uacalc;
    // setLayout(new BorderLayout());
    main = new JPanel();
    main.setMinimumSize(minimumSize);
    main.setPreferredSize(preferredSize);
    main.setLayout(new BorderLayout());
    JPanel fieldsPanel = new JPanel();
    main.add(fieldsPanel, BorderLayout.NORTH);
    setTopComponent(main);
    // monitorPanel = new MonitorPanel(uacalc);
    monitorPanel = uacalc.getMonitorPanel();
    // add(monitorPanel, BorderLayout.SOUTH);
    setBottomComponent(monitorPanel);
    setDividerLocation(getSize().height - getInsets().bottom - getDividerSize() - 150);
    /*
    fieldsPanel.add(new JLabel("Name:"));
    name_tf.setEditable(false);
    fieldsPanel.add(name_tf);

    fieldsPanel.add(new JLabel("Cardinality:"));
    card_tf.setEditable(false);
    fieldsPanel.add(card_tf);

    fieldsPanel.add(new JLabel("Description:"));
    desc_tf.setEditable(true);
    fieldsPanel.add(desc_tf);

    fieldsPanel.add(new JLabel("Operations"));
    resetOpsCB();
    fieldsPanel.add(ops_cb);
    ops_cb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        OpSymItem item = (OpSymItem)ops_cb.getSelectedItem();
        if (item == null) return;
        OperationSymbol opSym = item.getOperationSymbol();
        OperationWithDefaultValue op = opMap.get(opSym);
        if (op != null) {
          OperationInputTable opTable =
                    new OperationInputTable(op, uacalc);
          setOperationTable(opTable);
        }
        validate();
        repaint();
      }
    });
    JButton delOpButton = new JButton("Del Op");
    JButton addOpButton = new JButton("Add Op");
    fieldsPanel.add(delOpButton);
    fieldsPanel.add(addOpButton);
    delOpButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int n = JOptionPane.showConfirmDialog(
            uacalc,
            "Delete this operation?",
            "Delete this operatin?",
            JOptionPane.YES_NO_OPTION);
        if (n == JOptionPane.YES_OPTION) {
          removeCurrentOperation();
        }
      }
    });
    addOpButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (opTablePanel != null && !opTablePanel.stopCellEditing()) {
          uacalc.beep();
          return;
        }
        if (opList == null) {  // algebra
          uacalc.beep();
          return;
        }
        String name = getOpNameDialog();
        if (name == null) return;
        int arity = getArityDialog();
        if (arity == -1) return;
        addOperation(name, arity);
      }
    });
    */
    // add(main, BorderLayout.CENTER);
    validate();
  }
  public AddSupportForFrameworksPanel(
      final List<FrameworkSupportInModuleProvider> providers,
      final FrameworkSupportModelBase model,
      boolean vertical,
      @Nullable JPanel associatedFrameworksPanel) {
    myModel = model;
    myAssociatedFrameworksPanel = associatedFrameworksPanel;
    myLibrariesContainer = model.getLibrariesContainer();

    myLabel.setVisible(!vertical);
    Splitter splitter =
        vertical ? new Splitter(true, 0.6f, 0.2f, 0.8f) : new Splitter(false, 0.3f, 0.3f, 0.7f);
    splitter.setHonorComponentsMinimumSize(false);
    myFrameworksTree =
        new FrameworksTree(model) {
          @Override
          protected void onNodeStateChanged(CheckedTreeNode node) {
            if (!(node instanceof FrameworkSupportNode)) return;

            final FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode) node;
            if (frameworkSupportNode == getSelectedNode()) {
              updateOptionsPanel();
            }
            final FrameworkSupportInModuleConfigurable configurable =
                frameworkSupportNode.getConfigurable();
            configurable.onFrameworkSelectionChanged(node.isChecked());
            myModel.onFrameworkSelectionChanged(frameworkSupportNode);
            onFrameworkStateChanged();
          }
        };
    model.addFrameworkVersionListener(
        new FrameworkVersionListener() {
          @Override
          public void versionChanged(FrameworkVersion version) {
            ((DefaultTreeModel) myFrameworksTree.getModel()).nodeChanged(getSelectedNode());
          }
        },
        this);

    myFrameworksTree.addTreeSelectionListener(
        new TreeSelectionListener() {
          public void valueChanged(TreeSelectionEvent e) {
            onSelectionChanged();
          }
        });

    JPanel treePanel = new JPanel(new BorderLayout());
    treePanel.add(ScrollPaneFactory.createScrollPane(myFrameworksTree), BorderLayout.CENTER);
    treePanel.setMinimumSize(new Dimension(200, 300));

    splitter.setFirstComponent(treePanel);
    myOptionsPanel = new JPanel(new CardLayout());
    JPanel emptyCard = new JPanel();
    emptyCard.setPreferredSize(new Dimension(400, 100));
    myOptionsPanel.add(EMPTY_CARD, emptyCard);

    splitter.setSecondComponent(myOptionsPanel);
    myFrameworksPanel.add(splitter, BorderLayout.CENTER);

    setProviders(providers);
  }
  public JMovieControlAqua() {
    // Set the background color to the border color of the buttons.
    // This way the toolbar won't look too ugly when the buttons
    // are displayed before they have been loaded completely.
    // setBackground(new Color(118, 118, 118));
    setBackground(Color.WHITE);

    Dimension buttonSize = new Dimension(16, 16);
    GridBagLayout gridbag = new GridBagLayout();
    Insets margin = new Insets(0, 0, 0, 0);
    setLayout(gridbag);
    GridBagConstraints c;

    ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels");
    colorCyclingButton = new JToggleButton();
    colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText"));
    colorCyclingButton.addActionListener(this);
    colorCyclingButton.setPreferredSize(buttonSize);
    colorCyclingButton.setMinimumSize(buttonSize);
    colorCyclingButton.setVisible(false);
    colorCyclingButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(colorCyclingButton, c);
    add(colorCyclingButton);

    audioButton = new JToggleButton();
    audioButton.setToolTipText(labels.getString("audio.toolTipText"));
    audioButton.addActionListener(this);
    audioButton.setPreferredSize(buttonSize);
    audioButton.setMinimumSize(buttonSize);
    audioButton.setVisible(false);
    audioButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(audioButton, c);
    add(audioButton);

    startButton = new JToggleButton();
    startButton.setToolTipText(labels.getString("play.toolTipText"));
    startButton.addActionListener(this);
    startButton.setPreferredSize(buttonSize);
    startButton.setMinimumSize(buttonSize);
    startButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 1;
    // c.gridy = 0;
    gridbag.setConstraints(startButton, c);
    add(startButton);

    slider = new JMovieSliderAqua();
    c = new GridBagConstraints();
    // c.gridx = 2;
    // c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(slider, c);
    add(slider);

    rewindButton = new JButton();
    rewindButton.setToolTipText(labels.getString("previous.toolTipText"));
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 3;
    // c.gridy = 0;

    gridbag.setConstraints(rewindButton, c);
    add(rewindButton);
    rewindButton.addActionListener(this);

    forwardButton = new JButton();
    forwardButton.setToolTipText(labels.getString("next.toolTipText"));
    buttonSize = new Dimension(17, 16);
    forwardButton.setPreferredSize(buttonSize);
    forwardButton.setMinimumSize(buttonSize);
    forwardButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 4;
    // c.gridy = 0;
    gridbag.setConstraints(forwardButton, c);
    add(forwardButton);
    forwardButton.addActionListener(this);

    // The spacer is used when the play controls are hidden
    spacer = new JPanel(new BorderLayout());
    spacer.setVisible(false);
    spacer.setPreferredSize(new Dimension(16, 16));
    spacer.setMinimumSize(new Dimension(16, 16));
    spacer.setOpaque(false);
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(spacer, c);
    add(spacer);

    Border border =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.border.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderP.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4))));

    Border westBorder =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWest.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWestP.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4))));

    startButton.setBorder(westBorder);
    colorCyclingButton.setBorder(westBorder);
    audioButton.setBorder(westBorder);
    rewindButton.setBorder(westBorder);
    forwardButton.setBorder(border);
    startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton));
    colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton));
    forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton));

    colorCyclingButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setDisabledIcon(
        new ImageIcon(
            Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png")));
    audioButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png")));
    audioButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png")));
    audioButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png")));
    startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png")));
    startButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png")));
    startButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png")));
    rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png")));
    rewindButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png")));
    forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png")));
    forwardButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png")));

    // Automatic scrolling
    scrollHandler = new ScrollHandler();
    scrollTimer = new Timer(60, scrollHandler);
    scrollTimer.setInitialDelay(300); // default InitialDelay?
    forwardButton.addMouseListener(scrollHandler);
    rewindButton.addMouseListener(scrollHandler);
  }
  /*
   * GUI Code to add a modpack to the selection
   */
  public void addPack(final ModPack pack) {
    if (!modPacksAdded) {
      modPacksAdded = true;
      packs.removeAll();
      packs.repaint();
    }
    final int packIndex = packPanels.size();
    final JPanel p = new JPanel();
    p.setBounds(0, (packIndex * 55), 420, 55);
    p.setLayout(null);
    JLabel logo = new JLabel(new ImageIcon(pack.getLogo()));
    logo.setBounds(6, 6, 42, 42);
    logo.setVisible(true);

    JTextArea filler =
        new JTextArea(
            pack.getName()
                + " (v"
                + pack.getVersion()
                + ") Minecraft Version "
                + pack.getMcVersion()
                + "\n"
                + "By "
                + pack.getAuthor());
    filler.setBorder(null);
    filler.setEditable(false);
    filler.setForeground(LauncherStyle.getCurrentStyle().tabPaneForeground);
    filler.setBounds(58, 6, 362, 42);
    filler.setBackground(LauncherStyle.getCurrentStyle().tabPaneBackground);

    MouseAdapter lin =
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
              LaunchFrame.getInstance().doLaunch();
            }
          }

          @Override
          public void mousePressed(MouseEvent e) {
            selectedPack = packIndex;
            updatePacks();
          }
        };
    p.addMouseListener(lin);
    filler.addMouseListener(lin);
    logo.addMouseListener(lin);
    p.add(filler);
    p.add(logo);
    packPanels.add(p);
    packs.add(p);

    packs.setMinimumSize(new Dimension(420, (packPanels.size() * 55)));
    packs.setPreferredSize(new Dimension(420, (packPanels.size() * 55)));

    //
    // packsScroll.revalidate();
    if (pack.getDir().equalsIgnoreCase(getLastPack())) {
      selectedPack = packIndex;
    }
  }
示例#23
0
  /** Constructor for RestaurantGui class. Sets up all the gui components. */
  public RestaurantGui() {
    int WINDOWX = 600;
    int WINDOWY = 500;

    ButtonPanel = new JPanel();
    MrKrabs = new ImageIcon(getClass().getResource("/resources/MrKrabs.png"));
    Ramsay = new ImageIcon(getClass().getResource("/resources/Ramsay.png"));

    RestaurantPortion.setLayout(new BorderLayout());
    InformationPanel = new JPanel();
    InformationPanel.setLayout(new BorderLayout());
    buttonPanel = new JPanel();
    buttonPanel.setLayout(new BorderLayout());

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(25, 25, WINDOWX + 650, WINDOWY + 170);
    setVisible(true);

    setLayout(new BorderLayout());
    Dimension restDim = new Dimension(WINDOWX, (int) (WINDOWY * .86));
    restPanel.setPreferredSize(restDim);
    restPanel.setMinimumSize(restDim);
    restPanel.setMaximumSize(restDim);

    // pauseButton = new JButton("PAUSE");
    // pauseButton.addActionListener(this);
    refreshButton = new JButton("REFRESH");
    refreshButton.addActionListener(this);

    // CUSTOMER PANEL INFORMATION
    Dimension infoDimCustomer = new Dimension(WINDOWX, (int) (WINDOWY * .12));
    customerInformationPanel = new JPanel();
    customerInformationPanel.setPreferredSize(infoDimCustomer);
    customerInformationPanel.setMinimumSize(infoDimCustomer);
    customerInformationPanel.setMaximumSize(infoDimCustomer);
    customerInformationPanel.setBorder(BorderFactory.createTitledBorder("Customers"));

    customerStateCheckBox = new JCheckBox();
    customerStateCheckBox.setVisible(false);
    customerStateCheckBox.addActionListener(this);

    customerInformationPanel.setLayout(new GridLayout(1, 2, 30, 0));

    infoCustomerLabel = new JLabel();
    infoCustomerLabel.setText("<html><pre><i>There are no restaurant customers.</i></pre></html>");
    customerInformationPanel.add(infoCustomerLabel);
    customerInformationPanel.add(customerStateCheckBox);

    // WAITER PANEL INFORMATION/*
    /*
    Dimension infoDimWaiter = new Dimension(WINDOWX, (int) (WINDOWY * .12));
    waiterInformationPanel = new JPanel();
    waiterInformationPanel.setPreferredSize(infoDimWaiter);
    waiterInformationPanel.setMinimumSize(infoDimWaiter);
    waiterInformationPanel.setMaximumSize(infoDimWaiter);
    waiterInformationPanel.setBorder(BorderFactory.createTitledBorder("Waiters"));

    waiterON.addActionListener(this);
    waiterOFF.addActionListener(this);
    */
    // waiterInformationPanel.setLayout(new GridLayout(1, 2, 30, 0));

    infoWaiterLabel = new JLabel();
    infoWaiterLabel.setText("<html><pre><i>Click Add to make waiters</i></pre></html>");
    // waiterInformationPanel.add(infoWaiterLabel);
    waiterON.setVisible(false);
    waiterOFF.setVisible(false);
    // waiterInformationPanel.add(waiterON);
    // waiterInformationPanel.add(waiterOFF);
    RestaurantPortion.add(restPanel, BorderLayout.NORTH);
    InformationPanel.add(customerInformationPanel, BorderLayout.CENTER);
    MrKrabsButton = new JButton(MrKrabs);
    RamsayButton = new JButton(Ramsay);
    MrKrabsButton.addActionListener(this);
    RamsayButton.addActionListener(this);
    ButtonPanel.setLayout(new BorderLayout());
    ButtonPanel.add(MrKrabsButton, BorderLayout.WEST);
    ButtonPanel.add(RamsayButton, BorderLayout.EAST);
    InformationPanel.add(ButtonPanel, BorderLayout.SOUTH);
    // InformationPanel.add(waiterInformationPanel, BorderLayout.CENTER);
    RestaurantPortion.add(InformationPanel, BorderLayout.CENTER);
    // buttonPanel.add(pauseButton, BorderLayout.CENTER);
    buttonPanel.add(refreshButton, BorderLayout.CENTER);
    RestaurantPortion.add(buttonPanel, BorderLayout.SOUTH);

    add(animationPanel, BorderLayout.CENTER);
    add(RestaurantPortion, BorderLayout.EAST);
  }
示例#24
0
  public ThumbMaker() {
    super("ThumbMaker");

    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPrefs = ThumbMakerPreferences.getInstance();

    // content pane
    JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    setContentPane(pane);

    // top panel
    JPanel top = new JPanel();
    top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
    pane.add(top);

    // left-hand panel
    JPanel left = new JPanel();
    left.setLayout(new BoxLayout(left, BoxLayout.Y_AXIS));
    top.add(left);

    // horizontal padding
    top.add(Box.createHorizontalStrut(5));

    // label for file list
    JLabel listLabel = GUIUtil.makeLabel("Files to process:");
    listLabel.setDisplayedMnemonic('f');
    String listTip = "List of files from which to create thumbnails";
    listLabel.setToolTipText(listTip);
    left.add(GUIUtil.pad(listLabel));

    // list of files to convert
    list = new JList();
    listLabel.setLabelFor(list);
    list.setToolTipText(listTip);
    list.setModel(new DefaultListModel());
    list.setDragEnabled(true);
    changeFilesInList = new ThumbTransferHandler();
    list.setTransferHandler(changeFilesInList);
    left.add(new JScrollPane(list));

    // progress bar
    progress = new JProgressBar(0, 1);
    progress.setString("[Drag and drop files onto list to begin]");
    progress.setStringPainted(true);
    progress.setToolTipText("Status of thumbnail processing operation");
    left.add(progress);

    // panel for process and remove buttons
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // add files button
    addFiles = new JButton("Add Files");
    addFiles.setMnemonic('d');
    addFiles.setToolTipText("Add files to be processed.");
    addFiles.addActionListener(this);
    p.add(addFiles);

    p.add(Box.createHorizontalStrut(5));

    // process button
    process = new JButton("Process");
    process.setMnemonic('p');
    process.setToolTipText("Begin creating thumbnails");
    process.addActionListener(this);
    p.add(process);

    p.add(Box.createHorizontalStrut(5));

    // remove button
    remove = new JButton("Remove");
    remove.setMnemonic('v');
    remove.setToolTipText("Remove selected files from the list");
    remove.addActionListener(this);
    p.add(remove);

    left.add(GUIUtil.pad(p));

    // right-hand panel
    JPanel right = new JPanel();
    right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS));
    top.add(right);

    // panel for resolution settings
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // resolution label
    JLabel resLabel = GUIUtil.makeLabel("Resolution: ");
    resLabel.setDisplayedMnemonic('s');
    resLabel.setToolTipText("Resolution of the thumbnails");
    p.add(resLabel);

    // x resolution text box
    xres =
        GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME), 2);
    resLabel.setLabelFor(xres);
    xres.setToolTipText("Thumbnail width");
    p.add(xres);

    // "by" label
    JLabel byLabel = GUIUtil.makeLabel(" by ");
    byLabel.setDisplayedMnemonic('y');
    p.add(byLabel);

    // y resolution text box
    yres =
        GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME), 2);
    byLabel.setLabelFor(yres);
    yres.setToolTipText("Thumbnail height");
    p.add(yres);

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(8));

    // aspect ratio checkbox
    aspect = new JCheckBox("Maintain aspect ratio", true);
    aspect.setMnemonic('m');
    aspect.setToolTipText(
        "When checked, thumbnails are not stretched, "
            + "but rather padded with the background color.");
    aspect.addActionListener(this);
    right.add(GUIUtil.pad(aspect));
    // make sure that the check box is initialized correctly
    aspect.setSelected(
        myPrefs
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // panel for background color
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // load the color values from the preferences
    int redValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // background color label
    colorLabel = GUIUtil.makeLabel("Background color: ");
    String colorTip = "Thumbnail background color";
    colorLabel.setToolTipText(colorTip);
    p.add(colorLabel);

    // background color
    colorBox = new JPanel();
    colorBox.setToolTipText(colorTip);
    colorBox.setBorder(new LineBorder(Color.black, 1));
    Dimension colorBoxSize = new Dimension(45, 15);
    colorBox.setMaximumSize(colorBoxSize);
    colorBox.setMinimumSize(colorBoxSize);
    colorBox.setPreferredSize(colorBoxSize);
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));
    p.add(colorBox);

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(2));

    // red slider
    redLabel = GUIUtil.makeLabel("R");
    red = new JSlider(0, 255, redValueNumber);
    redValue = GUIUtil.makeLabel("" + redValueNumber);
    redValue.setToolTipText("Red color component slider");
    right.add(makeSlider(redLabel, red, redValue, "Red"));

    // green slider
    greenLabel = GUIUtil.makeLabel("G");
    green = new JSlider(0, 255, greenValueNumber);
    greenValue = GUIUtil.makeLabel("" + greenValueNumber);
    greenValue.setToolTipText("Green color component slider");
    right.add(makeSlider(greenLabel, green, greenValue, "Green"));

    // blue slider
    blueLabel = GUIUtil.makeLabel("B");
    blue = new JSlider(0, 255, blueValueNumber);
    blueValue = GUIUtil.makeLabel("" + blueValueNumber);
    right.add(makeSlider(blueLabel, blue, blueValue, "Blue"));

    right.add(Box.createVerticalStrut(8));

    // panel for algorithm
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // algorithm label
    JLabel algorithmLabel = GUIUtil.makeLabel("Algorithm: ");
    algorithmLabel.setDisplayedMnemonic('l');
    String algorithmTip = "Resizing algorithm to use";
    algorithmLabel.setToolTipText(algorithmTip);
    p.add(algorithmLabel);

    // algorithm combo box
    algorithm =
        GUIUtil.makeComboBox(
            new String[] {"Smooth", "Standard", "Fast", "Replicate", "Area averaging"});
    algorithmLabel.setLabelFor(algorithm);
    algorithm.setToolTipText(algorithmTip);
    p.add(algorithm);
    // set the algorithm value from the preferences
    algorithm.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    right.add(GUIUtil.pad(p));

    // panel for output format
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // format label
    JLabel formatLabel = GUIUtil.makeLabel("Format: ");
    formatLabel.setDisplayedMnemonic('f');
    String formatTip = "Thumbnail output format";
    formatLabel.setToolTipText(formatTip);
    p.add(formatLabel);

    // format combo box
    format = GUIUtil.makeComboBox(new String[] {"PNG", "JPG"});
    formatLabel.setLabelFor(format);
    format.setToolTipText(formatTip);
    p.add(format);
    // set the format value from the preferences
    format.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(5));

    // panel for prepend string
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // prepend label
    JLabel prependLabel = GUIUtil.makeLabel("Prepend: ");
    prependLabel.setDisplayedMnemonic('e');
    String prependTip = "Starting string for each thumbnail filename";
    prependLabel.setToolTipText(prependTip);
    p.add(prependLabel);

    // prepend field
    prepend =
        GUIUtil.makeTextField(
            myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME), 4);
    prependLabel.setLabelFor(prepend);
    prepend.setToolTipText(prependTip);
    p.add(prepend);

    p.add(Box.createHorizontalStrut(5));

    // append label
    JLabel appendLabel = GUIUtil.makeLabel("Append: ");
    appendLabel.setDisplayedMnemonic('a');
    String appendTip = "Ending string for each thumbnail filename";
    appendLabel.setToolTipText(appendTip);
    p.add(appendLabel);

    // append field
    append =
        GUIUtil.makeTextField(
            myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME), 4);
    appendLabel.setLabelFor(append);
    append.setToolTipText(appendTip);
    p.add(append);

    right.add(GUIUtil.pad(p));

    // vertical padding
    right.add(Box.createVerticalGlue());

    // bottom panel
    JPanel bottom = new JPanel();
    bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS));
    pane.add(bottom);

    // output folder label
    JLabel outputLabel = GUIUtil.makeLabel("Output folder: ");
    outputLabel.setDisplayedMnemonic('o');
    String outputTip = "Thumbnail output folder";
    outputLabel.setToolTipText(outputTip);
    bottom.add(outputLabel);

    // output folder field
    String filePath =
        new File(myPrefs.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME))
            .getAbsolutePath();
    output = GUIUtil.makeTextField(filePath, 8);
    outputLabel.setLabelFor(output);
    output.setToolTipText(outputTip);
    // start this in default and then lock down so "..." is used
    output.setEditable(false);
    output.setBackground(Color.LIGHT_GRAY);
    bottom.add(output);

    // add a file chooser button "..."
    dotDotDot = new JButton("...");
    dotDotDot.setMnemonic('.');
    dotDotDot.setToolTipText("Select destination directory.");
    dotDotDot.addActionListener(this);
    bottom.add(dotDotDot);

    right.add(GUIUtil.pad(p));

    setFromPreferences();
    addWindowListener(this);
  }
 /**
  * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
  * call it in your code!
  *
  * @noinspection ALL
  */
 private void $$$setupUI$$$() {
   createUIComponents();
   pnlMain = new JPanel();
   pnlMain.setLayout(
       new FormLayout(
           "fill:d:grow",
           "fill:120dlu:noGrow,top:4dlu:noGrow,center:d:grow,top:4dlu:noGrow,fill:16dlu:noGrow"));
   pnlMain.setMinimumSize(new Dimension(750, 435));
   pnlMain.setPreferredSize(new Dimension(750, 435));
   pnlForm.setLayout(
       new FormLayout(
           "fill:50dlu:noGrow,left:4dlu:noGrow,fill:50dlu:noGrow,left:4dlu:noGrow,fill:10dlu:noGrow,left:4dlu:noGrow,fill:50dlu:noGrow,left:4dlu:noGrow,fill:50dlu:noGrow,left:4dlu:noGrow,fill:50dlu:noGrow,left:4dlu:noGrow,fill:40dlu:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow",
           "fill:12dlu:noGrow,top:4dlu:noGrow,fill:12dlu:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,fill:12dlu:noGrow,top:4dlu:noGrow,fill:12dlu:noGrow"));
   CellConstraints cc = new CellConstraints();
   pnlMain.add(pnlForm, cc.xy(1, 1));
   lblBuscar = new JLabel();
   lblBuscar.setText("Código ");
   pnlForm.add(lblBuscar, cc.xy(1, 1));
   txtCoInstitucion = new JTextField();
   pnlForm.add(txtCoInstitucion, cc.xy(1, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
   chkEstado = new JCheckBox();
   chkEstado.setText("");
   pnlForm.add(chkEstado, cc.xy(15, 7));
   lblEstado = new JLabel();
   lblEstado.setText("Estado");
   pnlForm.add(lblEstado, cc.xy(13, 7));
   lblNuNroCuenta = new JLabel();
   lblNuNroCuenta.setText("N° Cuenta");
   pnlForm.add(lblNuNroCuenta, cc.xy(1, 9));
   txtNuNroCuenta = new JTextField();
   pnlForm.add(txtNuNroCuenta, cc.xyw(3, 9, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
   lblProveedor = new JLabel();
   lblProveedor.setText("Institución");
   pnlForm.add(lblProveedor, cc.xy(7, 1));
   txtDeCortaInstitucion = new JTextField();
   pnlForm.add(
       txtDeCortaInstitucion, cc.xyw(3, 5, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
   txtDeInstitucion = new JTextField();
   pnlForm.add(txtDeInstitucion, cc.xyw(7, 3, 9, CellConstraints.FILL, CellConstraints.DEFAULT));
   lblDeMensajeLargo = new JLabel();
   lblDeMensajeLargo.setText("RUC");
   pnlForm.add(lblDeMensajeLargo, cc.xy(3, 1));
   txtNuRucInstitucion = new JTextField();
   pnlForm.add(txtNuRucInstitucion, cc.xy(3, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
   lblDeCortaInstitucion = new JLabel();
   lblDeCortaInstitucion.setText("Desc. Corta");
   pnlForm.add(lblDeCortaInstitucion, cc.xy(1, 5));
   lblNuTelReferencia = new JLabel();
   lblNuTelReferencia.setText("Teléfono");
   pnlForm.add(lblNuTelReferencia, cc.xy(9, 5));
   txtNuTelReferencia = new JTextField();
   pnlForm.add(txtNuTelReferencia, cc.xy(11, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
   lblObservacion = new JLabel();
   lblObservacion.setText("Dirección");
   pnlForm.add(lblObservacion, cc.xy(1, 7));
   txtDeDireccion = new JTextField();
   pnlForm.add(txtDeDireccion, cc.xyw(3, 7, 9, CellConstraints.FILL, CellConstraints.DEFAULT));
   lblNoContacto = new JLabel();
   lblNoContacto.setText("Contacto");
   pnlForm.add(lblNoContacto, cc.xy(9, 9));
   txtNoContacto = new JTextField();
   pnlForm.add(txtNoContacto, cc.xyw(11, 9, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
   footerPanel = new JPanel();
   footerPanel.setLayout(new FormLayout("right:d:grow", "fill:16dlu:noGrow"));
   pnlMain.add(footerPanel, cc.xy(1, 5));
   lblEsc = new JLabel();
   lblEsc.setText("Esc = Salir");
   footerPanel.add(lblEsc, cc.xy(1, 1));
   pnlGrid = new JPanel();
   pnlGrid.setLayout(
       new FormLayout("fill:612px:noGrow", "center:d:noGrow,top:4dlu:noGrow,center:d:grow"));
   pnlMain.add(pnlGrid, cc.xy(1, 3));
   pnlTitGrid = new JPanel();
   pnlTitGrid.setLayout(
       new FormLayout("fill:16dlu:noGrow,left:4dlu:noGrow,fill:d:grow", "fill:16dlu:noGrow"));
   pnlGrid.add(pnlTitGrid, cc.xy(1, 1));
   chkSel = new JCheckBox();
   chkSel.setText("");
   pnlTitGrid.add(chkSel, cc.xy(1, 1));
   lblTitGrid = new JLabel();
   lblTitGrid.setText("Locales");
   pnlTitGrid.add(lblTitGrid, cc.xy(3, 1));
   pnlResult = new JScrollPane();
   pnlGrid.add(pnlResult, cc.xy(1, 3, CellConstraints.FILL, CellConstraints.FILL));
   tblGrid = new JTable();
   pnlResult.setViewportView(tblGrid);
 }
  private void jbInit() throws Exception {
    border1 = BorderFactory.createRaisedBevelBorder();
    jPanel1.setLayout(gridLayout1);
    panel2.setBorder(border1);
    panel2.setMaximumSize(new Dimension(400, 200));
    panel2.setMinimumSize(new Dimension(400, 200));
    panel2.setLayout(gridBagLayout2);
    button1.setText("OK");
    button1.addActionListener(new insertMapDialog_button1_actionAdapter(this));
    button2.setText("Cancel");
    gridLayout1.setHgap(4);
    button2.addActionListener(new insertMapDialog_button2_actionAdapter(this));
    this.addWindowListener(new insertMapDialog_this_windowAdapter(this));
    InsertMapPanel.setLayout(gridBagLayout1);
    upperLeftLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    upperLeftLabel.setText("Upper-left Hex:");
    headerLabel.setText("Please enter the hex where the upper-left ");
    upperLeftTextField.setText("A1");
    jLabel1.setText("corner of the selected map will be placed:");
    InsertMapPanel.add(
        jPanel1,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(4, 8, 4, 8),
            0,
            0));
    jPanel1.add(button1, null);
    jPanel1.add(button2, null);
    InsertMapPanel.add(
        panel2,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 2),
            0,
            0));
    panel2.add(
        upperLeftLabel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(20, 118, 4, 12),
            88,
            5));
    panel2.add(
        headerLabel,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHEAST,
            GridBagConstraints.NONE,
            new Insets(-7, 186, 0, 156),
            69,
            12));
    panel2.add(
        upperLeftTextField,
        new GridBagConstraints(
            1,
            2,
            1,
            2,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(17, 0, 0, 0),
            65,
            0));
    panel2.add(
        jLabel1,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 16, 0, 0),
            225,
            0));
    getContentPane().add(InsertMapPanel);

    panel2.setPreferredSize(new Dimension(400, 200));
    this.validate();
  }
示例#27
0
  private void jbInit() throws Exception {

    saveButton.setText("Save");
    saveButton.addActionListener(new PrintfTemplateEditor_saveButton_actionAdapter(this));
    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new PrintfTemplateEditor_cancelButton_actionAdapter(this));
    this.setTitle(this.getTitle() + " Template Editor");
    printfPanel.setLayout(gridBagLayout1);
    formatLabel.setFont(new java.awt.Font("DialogInput", 0, 12));
    formatLabel.setText("Format String:");
    buttonPanel.setLayout(flowLayout1);
    printfPanel.setBorder(BorderFactory.createEtchedBorder());
    printfPanel.setMinimumSize(new Dimension(100, 160));
    printfPanel.setPreferredSize(new Dimension(380, 160));
    parameterPanel.setLayout(gridBagLayout2);
    parameterLabel.setText("Parameters:");
    parameterLabel.setFont(new java.awt.Font("DialogInput", 0, 12));
    parameterTextArea.setMinimumSize(new Dimension(100, 25));
    parameterTextArea.setPreferredSize(new Dimension(200, 25));
    parameterTextArea.setEditable(true);
    parameterTextArea.setText("");
    insertButton.setMaximumSize(new Dimension(136, 20));
    insertButton.setMinimumSize(new Dimension(136, 20));
    insertButton.setPreferredSize(new Dimension(136, 20));
    insertButton.setToolTipText(
        "insert the format in the format string and add parameter to list.");
    insertButton.setText("Insert Parameter");
    insertButton.addActionListener(new PrintfTemplateEditor_insertButton_actionAdapter(this));
    formatTextArea.setMinimumSize(new Dimension(100, 25));
    formatTextArea.setPreferredSize(new Dimension(200, 15));
    formatTextArea.setText("");
    parameterPanel.setBorder(null);
    parameterPanel.setMinimumSize(new Dimension(60, 40));
    parameterPanel.setPreferredSize(new Dimension(300, 40));
    insertMatchButton.addActionListener(
        new PrintfTemplateEditor_insertMatchButton_actionAdapter(this));
    insertMatchButton.setText("Insert Match");
    insertMatchButton.setToolTipText(
        "insert the match in the format string and add parameter to list.");
    insertMatchButton.setPreferredSize(new Dimension(136, 20));
    insertMatchButton.setMinimumSize(new Dimension(136, 20));
    insertMatchButton.setMaximumSize(new Dimension(136, 20));
    matchPanel.setPreferredSize(new Dimension(300, 40));
    matchPanel.setBorder(null);
    matchPanel.setMinimumSize(new Dimension(60, 60));
    matchPanel.setLayout(gridBagLayout3);
    InsertPanel.setLayout(gridLayout1);
    gridLayout1.setColumns(1);
    gridLayout1.setRows(2);
    gridLayout1.setVgap(0);
    InsertPanel.setBorder(BorderFactory.createEtchedBorder());
    InsertPanel.setMinimumSize(new Dimension(100, 100));
    InsertPanel.setPreferredSize(new Dimension(380, 120));
    editorPane.setText("");
    editorPane.addKeyListener(new PrintfEditor_editorPane_keyAdapter(this));
    printfTabPane.addChangeListener(new PrintfEditor_printfTabPane_changeAdapter(this));
    parameterPanel.add(
        insertButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 6, 13, 8),
            0,
            10));
    parameterPanel.add(
        paramComboBox,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(8, 8, 13, 0),
            258,
            11));
    paramComboBox.setRenderer(new MyCellRenderer());
    InsertPanel.add(matchPanel, null);
    InsertPanel.add(parameterPanel, null);
    buttonPanel.add(cancelButton, null);
    buttonPanel.add(saveButton, null);
    this.getContentPane().add(printfTabPane, BorderLayout.NORTH);
    this.getContentPane().add(InsertPanel, BorderLayout.CENTER);
    matchPanel.add(
        insertMatchButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 6, 13, 8),
            0,
            10));
    matchPanel.add(
        matchComboBox,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(8, 8, 13, 0),
            258,
            11));
    printfPanel.add(
        parameterLabel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(7, 5, 0, 5),
            309,
            0));
    printfPanel.add(
        formatLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(4, 5, 0, 5),
            288,
            0));
    printfPanel.add(
        formatTextArea,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(6, 5, 0, 5),
            300,
            34));
    printfPanel.add(
        parameterTextArea,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(6, 5, 6, 5),
            300,
            34));
    printfTabPane.addTab("Editor View", null, editorPanel, "View in Editor");
    printfTabPane.addTab("Printf View", null, printfPanel, "Vies as Printf");
    editorPane.setCharacterAttributes(PLAIN_ATTR, true);
    editorPane.addStyle("PLAIN", editorPane.getLogicalStyle());
    editorPanel.getViewport().add(editorPane, null);
    this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    buttonGroup.add(cancelButton);
  }
  /** Construct a new dialog. */
  public JExecDetailsDialog() {
    super("Execution Details");

    /* create dialog body components */
    {
      JPanel body = new JPanel();
      body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));

      {
        JPanel panel = new JPanel();
        panel.setName("MainDialogPanel");
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

        /* working directory */
        {
          panel.add(UIFactory.createPanelLabel("Working Directory:"));

          panel.add(Box.createRigidArea(new Dimension(0, 4)));

          JTextField field = UIFactory.createTextField(null, 100, JLabel.LEFT);
          pWorkingDirField = field;

          panel.add(field);
        }

        body.add(panel);
      }

      {
        JPanel panel = new JPanel();
        panel.setName("HorizontalBar");

        Dimension size = new Dimension(100, 7);
        panel.setPreferredSize(size);
        panel.setMinimumSize(size);
        panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 7));

        body.add(panel);
      }

      /* command line */
      JPanel above = new JPanel();
      {
        above.setName("MainDialogPanel");
        above.setLayout(new BoxLayout(above, BoxLayout.Y_AXIS));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("X");
            pCommandLineLabel = label;

            label.setName("PanelLabel");

            hbox.add(label);
          }

          hbox.add(Box.createHorizontalGlue());

          above.add(hbox);
        }

        above.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          JTextArea area = new JTextArea(null, 5, 70);
          pCommandLineArea = area;

          area.setName("CodeTextArea");
          area.setLineWrap(true);
          area.setWrapStyleWord(true);
          area.setEditable(false);
        }

        {
          JScrollPane scroll =
              UIFactory.createScrollPane(
                  pCommandLineArea,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(100, 27),
                  null,
                  null);

          above.add(scroll);
        }
      }

      /* environment */
      JPanel below = new JPanel();
      {
        below.setName("MainDialogPanel");
        below.setLayout(new BoxLayout(below, BoxLayout.Y_AXIS));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("X");
            pEnvLabel = label;

            label.setName("PanelLabel");

            hbox.add(label);
          }

          hbox.add(Box.createHorizontalGlue());

          below.add(hbox);
        }

        below.add(Box.createRigidArea(new Dimension(0, 4)));

        Component comps[] = UIFactory.createTitledPanels();
        {
          JPanel tpanel = (JPanel) comps[0];
          JPanel vpanel = (JPanel) comps[1];

          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }

        {
          pEnvScroll =
              UIFactory.createScrollPane(
                  comps[2],
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(100, 50),
                  new Dimension(100, 300),
                  null);

          below.add(pEnvScroll);
        }
      }

      {
        JVertSplitPanel split = new JVertSplitPanel(above, below);
        split.setResizeWeight(0.0);
        split.setAlignmentX(0.5f);

        body.add(split);
      }

      super.initUI("X", body, null, null, null, "Close", null);
    }
  }
示例#29
0
  private void setupComponents() {
    panel.removeAll();

    JScrollPane scrollPane1 =
        new JScrollPane(
            parametersTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane1.setOpaque(false);

    ActionPanel actionPanel1 = new ActionPanel(false);
    actionPanel1.setAddAction(addParameterAction);
    actionPanel1.setRemoveAction(removeParameterAction);
    actionPanel1.setAddToolTipText("Use this button to add an existing parameter to the prior");
    actionPanel1.setRemoveToolTipText("Use this button to remove a parameter from the prior");

    removeParameterAction.setEnabled(false);

    JPanel controlPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    controlPanel1.setOpaque(false);
    controlPanel1.add(actionPanel1);

    JPanel panel1 = new JPanel(new BorderLayout(0, 0));
    panel1.setOpaque(false);
    panel1.add(new JLabel("Linked parameters:"), BorderLayout.NORTH);
    panel1.add(scrollPane1, BorderLayout.CENTER);

    // removing the control panel for now. Not sure whether we really want adding and
    // removing of parameteres in this dialog.
    //        panel1.add(controlPanel1, BorderLayout.SOUTH);
    panel1.setSize(new Dimension(PREFERRED_TABLE_WIDTH, PREFERRED_TABLE_HEIGHT));
    panel1.setPreferredSize(new Dimension(PREFERRED_TABLE_WIDTH, PREFERRED_TABLE_HEIGHT));
    panel1.setMinimumSize(new Dimension(MINIMUM_TABLE_WIDTH, MINIMUM_TABLE_HEIGHT));

    OptionsPanel optionsPanel = new OptionsPanel(0, 6);
    if (parameter.getName() != null) {
      nameField.setText(parameter.getName());
    } else {
      nameField.setText("Untitled");
    }
    optionsPanel.addComponentWithLabel("Unique Name: ", nameField);
    //        optionsPanel.addComponentWithLabel("Initial Value: ", initialField);

    panel.setOpaque(false);
    panel.setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = 2;
    panel.add(optionsPanel, c);

    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.VERTICAL;
    c.gridwidth = 1;
    panel.add(panel1, c);

    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.PAGE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;
    panel.add(priorSettingsPanel, c);
  }
示例#30
0
  public void initUI(int x, int y) {
    setVisible(true);

    loadIcons();

    dx = x;
    dy = y;
    text_height = getFontMetrics(getFont()).getHeight();
    plane_width = icon_size;
    plane_height = icon_size + text_height + text_gap;
    radar_area_width = grid_size * dx;
    radar_area_height = grid_size * dy;

    getContentPane().setLayout(new BorderLayout());

    radarArea = new RadarPane();
    radarArea.setMinimumSize(new Dimension(radar_area_width, radar_area_height));
    radarArea.setPreferredSize(new Dimension(radar_area_width, radar_area_height));
    getContentPane().add(radarArea, BorderLayout.CENTER);

    radarArea.backImage =
        new BufferedImage(radar_area_width, radar_area_height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = radarArea.backImage.createGraphics();
    g.setBackground(back_color);
    g.setColor(rim_color);
    g.fillRect(0, 0, radar_area_width, radar_area_height);
    g.setColor(back_color);
    g.fillRect(convPos(0), convPos(0), radar_area_width - grid_size, radar_area_height - grid_size);
    g.setColor(line_color);
    int i, j;
    for (i = 0; i < dx; i++)
      for (j = 0; j < dy; j++) g.draw(new Rectangle(convPos(i) - 1, convPos(j) - 1, 1, 1));

    radarArea.backIcon = new ImageIcon(radarArea.backImage);
    radarArea.back = new JLabel(radarArea.backIcon);
    radarArea.back.setBounds(0, 0, radar_area_width, radar_area_height);
    radarArea.add(radarArea.back, new Integer(0));

    infoArea = new JPanel();
    infoArea.setMinimumSize(new Dimension(info_area_width, radar_area_height));
    infoArea.setPreferredSize(new Dimension(info_area_width, radar_area_height));
    infoArea.setLayout(new GridLayout(27, 1));
    infoTopLine = new Label(" ");
    infoArea.add(infoTopLine);
    getContentPane().add(infoArea, BorderLayout.EAST);

    inputArea = new JLabel("          ");
    getContentPane().add(inputArea, BorderLayout.SOUTH);

    controlArea = new JPanel();
    newButton = new JButton("New");
    newButton.setActionCommand("New");
    newButton.addActionListener(this);
    newButton.setEnabled(false);
    newButton.setFocusable(false);
    exitButton = new JButton("Exit");
    exitButton.setActionCommand("Exit");
    exitButton.addActionListener(this);
    exitButton.setFocusable(false);
    controlArea.add(newButton);
    controlArea.add(exitButton);
    getContentPane().add(controlArea, BorderLayout.NORTH);

    pack();
  }