private void addContinFilter(final Container pane) {

    GridLayout layout = new GridLayout(0, 2);

    layout.setVgap(GAP);

    final JPanel panel = new JPanel();
    pane.add(panel, BorderLayout.NORTH);

    panel.setLayout(layout);
    layout.layoutContainer(panel);

    panel.setBorder(BorderFactory.createTitledBorder("Show contin(s):"));

    add(
        "with number (ex. 2, 4-9, 30)",
        Display2DOptions.ContinFilterType.custom_number,
        continNumberInput,
        panel);

    add(
        "with name (ex. ContinA, ContinB)",
        Display2DOptions.ContinFilterType.custom_name,
        continNameInput,
        panel);

    add(
        "with color code (ex. blue-10, green-5)",
        Display2DOptions.ContinFilterType.custom_color_code,
        continColorInput,
        panel);
  }
Esempio n. 2
0
 /**
  * Adds a component to the layout.
  *
  * @param name The name of the component to add.
  * @param component the component to add to the layout.
  */
 public void addLayoutComponent(String name, Component component) {
   if (way == X_AXIS
       || (way == LINE_AXIS && component.getComponentOrientation().isHorizontal())
       || (way == PAGE_AXIS && !component.getComponentOrientation().isHorizontal()))
     grid.setColumns(grid.getColumns() + 1);
   else grid.setRows(grid.getRows() + 1);
 }
 /**
  * This method initializes this
  *
  * @return void
  */
 private void initialize() {
   this.setSize(400, (1) * 30);
   java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated
   layGridLayout.setRows(1); // Generated
   this.setLayout(layGridLayout); // Generated
   this.add(getJPanelexten(), null); // Generated
 }
  private JPanel createParametersPanel() {
    JPanel parametersPanel = new JPanel();
    parametersPanel.setBorder(BorderFactory.createTitledBorder(dataLayer.getString("PARAMETERS")));

    GridLayout parametersPanelLayout = new GridLayout(0, 3);
    parametersPanelLayout.setHgap(10);
    parametersPanelLayout.setVgap(5);
    parametersPanel.setLayout(parametersPanelLayout);
    //
    // -- DELAY ------------------------------------------------------------
    JLabel delayName = new JLabel(dataLayer.getString("DELAY") + ":");
    delayName.setFont(fontBold);
    parametersPanel.add(delayName);

    // create formatter
    RegexFormatter delayFormatter = new RegexFormatter(Validator.DELAY_PATTERN);
    delayFormatter.setAllowsInvalid(true); // allow to enter invalid value for short time
    delayFormatter.setCommitsOnValidEdit(true); // value is immedeatly published to textField
    delayFormatter.setOverwriteMode(false); // do not overwrite charracters

    jTextFieldDelay = new JFormattedTextField(delayFormatter);
    jTextFieldDelay.setText("" + cable.getDelay());
    jTextFieldDelay.setToolTipText(dataLayer.getString("REQUIRED_FORMAT_IS") + " 1-99");
    // add decorator that paints wrong input icon
    parametersPanel.add(new JLayer<JFormattedTextField>(jTextFieldDelay, layerUI));

    JLabel delayTip = new JLabel("1-99");
    parametersPanel.add(delayTip);

    // --  ------------------------------------------------------------
    return parametersPanel;
  }
  /**
   * A partir de un iterador de libros actualiza los resultados de un búsqueda donde se pueden
   * devolver libros.
   *
   * @param libros Iterador que apunta al primer libro del resultado de la búsqueda.
   */
  public void actualizarListaAlquilados(Iterador<ILibro> libros) {
    panelCentral.removeAll();
    anhanirLabeles();
    int i = 0;
    if (libros != null) {

      while (libros.haySiguiente()) {
        ILibro libro = libros.darSiguiente();
        panelCentral.add(new PanelLibroAlquilado(libro, principal));
        i++;
      }
      if (i <= 5) layout.setRows(7);
      else {
        layout.setRows(i + 2);
        panelCentral.setSize(511, i * 146);
      }
      for (int j = i + 2; j < 6; j++) {
        JPanel panel = new JPanel();
        panel.setBackground(Color.WHITE);
        panelCentral.add(panel);
      }
      labelMostrarResultados.setText("Resultados de la búsqueda: " + i);
      panelCentral.repaint();
    }
  }
Esempio n. 6
0
  /**
   * This method initializes jPanel
   *
   * @return JPanel
   */
  private JPanel getJPanel() {
    if (jPanel == null) {
      jPanel = new JPanel();
      java.awt.GridLayout layGridLayout7 = new java.awt.GridLayout();
      layGridLayout7.setRows(4);
      layGridLayout7.setColumns(4);
      layGridLayout7.setHgap(10);
      layGridLayout7.setVgap(10);
      jPanel.setLayout(layGridLayout7);

      // Another way to do this, but wouldn't
      // have a visual in the editor.
      //  for (int i = 1; i <= 16; i++) {
      //      String label = String.valueOf(i);
      //      JButton b = new JButton(label);
      //      b.addMouseListener(buttonEvents);
      //      b.addMouseMotionListener(buttonEvents);
      //      jPanel.add(b);
      //  }

      for (int i = 0; i < jButtons.length; i++) {
        jButtons[i] = createButton(String.valueOf(i + 1));
        jPanel.add(jButtons[i], null);
      }

      jPanel.setBackground(java.awt.Color.white);
      jPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
    }
    return jPanel;
  }
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
Esempio n. 8
0
 /**
  * Component initialization.
  *
  * @throws java.lang.Exception
  */
 private void jbInit() throws Exception {
   image1 = new ImageIcon(pt.inescporto.siasoft.MenuFrame.class.getResource("about.png"));
   imageLabel.setIcon(image1);
   setTitle("About");
   panel1.setLayout(borderLayout1);
   panel2.setLayout(borderLayout2);
   insetsPanel1.setLayout(flowLayout1);
   insetsPanel2.setLayout(flowLayout1);
   insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
   gridLayout1.setRows(4);
   gridLayout1.setColumns(1);
   label1.setText(product);
   label2.setText(version);
   label3.setText(copyright);
   label4.setText(comments);
   insetsPanel3.setLayout(gridLayout1);
   insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10));
   button1.setText("OK");
   button1.addActionListener(this);
   insetsPanel2.add(imageLabel, null);
   panel2.add(insetsPanel2, BorderLayout.WEST);
   getContentPane().add(panel1, null);
   insetsPanel3.add(label1, null);
   insetsPanel3.add(label2, null);
   insetsPanel3.add(label3, null);
   insetsPanel3.add(label4, null);
   panel2.add(insetsPanel3, BorderLayout.CENTER);
   insetsPanel1.add(button1, null);
   panel1.add(insetsPanel1, BorderLayout.SOUTH);
   panel1.add(panel2, BorderLayout.NORTH);
   setResizable(true);
 }
  private JPanel createInfoPanel() {
    JPanel infoPanel = new JPanel();
    infoPanel.setBorder(BorderFactory.createTitledBorder(dataLayer.getString("INFO")));

    GridLayout infoPanelLayout = new GridLayout(0, 2);
    infoPanelLayout.setHgap(10);
    infoPanelLayout.setVgap(5);
    infoPanel.setLayout(infoPanelLayout);
    //
    // -- TYPE -------------------------------------------------------------
    JLabel typeName = new JLabel(dataLayer.getString("TYPE") + ":");
    fontBold = new Font(typeName.getFont().getName(), Font.BOLD, typeName.getFont().getSize());
    typeName.setFont(fontBold);
    infoPanel.add(typeName);

    JLabel typeValue = new JLabel(cable.getHwType().toString());
    infoPanel.add(typeValue);
    //
    // -- DEVICE 1 name and interface --------------------------------------
    JLabel device1Name = new JLabel(dataLayer.getString("COMPONENT") + " 1:");
    device1Name.setFont(fontBold);
    infoPanel.add(device1Name);

    JLabel device1Value = new JLabel(cable.getComponent1().getDeviceName());
    infoPanel.add(device1Value);
    //
    JLabel interface1Name = new JLabel(dataLayer.getString("INTERFACE") + " 1:");
    interface1Name.setFont(fontBold);
    infoPanel.add(interface1Name);

    JLabel interface1Value = new JLabel(cable.getEth1().getName());
    infoPanel.add(interface1Value);
    //
    // -- DEVICE 2 name and interface --------------------------------------
    JLabel device2Name = new JLabel(dataLayer.getString("COMPONENT") + " 2:");
    device2Name.setFont(fontBold);
    infoPanel.add(device2Name);

    JLabel device2Value = new JLabel(cable.getComponent2().getDeviceName());
    infoPanel.add(device2Value);
    //
    JLabel interface2Name = new JLabel(dataLayer.getString("INTERFACE") + " 2:");
    interface2Name.setFont(fontBold);
    infoPanel.add(interface2Name);

    JLabel interface2Value = new JLabel(cable.getEth2().getName());
    infoPanel.add(interface2Value);
    //
    // -- UNIQUE ID --------------------------------------------------------
    if (viewUniqueId) {
      JLabel deviceIdName = new JLabel(dataLayer.getString("DEVICE_UNIQUE_ID") + ":");
      deviceIdName.setFont(fontBold);
      infoPanel.add(deviceIdName);

      JLabel deviceIdValue = new JLabel("" + cable.getId().toString());
      infoPanel.add(deviceIdValue);
    }

    return infoPanel;
  }
 private JPanel getJPanel1() {
   if (jPanel1 == null) {
     jPanel1 = new JPanel();
     GridLayout jPanel1Layout = new GridLayout(7, 2);
     jPanel1Layout.setColumns(2);
     jPanel1Layout.setHgap(5);
     jPanel1Layout.setVgap(5);
     jPanel1Layout.setRows(7);
     jPanel1.setLayout(jPanel1Layout);
     jPanel1.add(getJLabel1());
     jPanel1.add(getJTextField1());
     jPanel1.add(getJLabel2());
     jPanel1.add(getJTextField2());
     jPanel1.add(getJLabel3());
     jPanel1.add(getJTextField3());
     jPanel1.add(getJLabel4());
     jPanel1.add(getJTextField4());
     jPanel1.add(getJLabel5());
     jPanel1.add(getJTextField5());
     jPanel1.add(getJLabel6());
     jPanel1.add(getJTextField6());
     jPanel1.add(getJLabel7());
     jPanel1.add(getJTextField7());
   }
   return jPanel1;
 }
Esempio n. 11
0
 private GridLayout createButtonPanelLayout() {
   GridLayout buttonPanelLayout = new GridLayout(2, 2);
   buttonPanelLayout.setColumns(2);
   buttonPanelLayout.setHgap(5);
   buttonPanelLayout.setVgap(5);
   buttonPanelLayout.setRows(2);
   return buttonPanelLayout;
 }
 /**
  * This method initializes this
  *
  * @return void
  */
 private void initialize() {
   this.setSize(400, (2) * 30);
   java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated
   layGridLayout.setRows(2); // Generated
   this.setLayout(layGridLayout); // Generated
   this.add(getJPanelfamily(), null); // Generated
   this.add(getJPanelkeytree(), null); // Generated
 }
Esempio n. 13
0
 /**
  * Sets up the BrowsePanel, in preparation for being populated with lines of Product information.
  */
 public void createBrowsePanel() {
   GridLayout grid = new GridLayout();
   grid.setColumns(1);
   browsePanel.setLayout(grid);
   JScrollPane scrollPane = new JScrollPane(browsePanel);
   scrollPane.getVerticalScrollBar().setUnitIncrement(12);
   this.add(scrollPane, BorderLayout.CENTER);
 }
  public void addCarrier(FireflyCarrier carrier) {
    list.add(carrier);
    add(carrier);

    int columns = (int) Math.floor(Math.sqrt(list.size()));
    gridLayout.setColumns(columns);
    gridLayout.setRows(list.size() / columns);
    updateUI();
  }
Esempio n. 15
0
  /**
   * Removes a component from the layout.
   *
   * @param component The component to remove from the layout.
   */
  public void removeLayoutComponent(Component component) {
    grid.removeLayoutComponent(component);

    if (way == X_AXIS
        || (way == LINE_AXIS && component.getComponentOrientation().isHorizontal())
        || (way == PAGE_AXIS && !component.getComponentOrientation().isHorizontal()))
      grid.setColumns(grid.getColumns() - 1);
    else grid.setRows(grid.getRows() - 1);
  }
 public void componentResized(ComponentEvent e) {
   GridLayout layout = (GridLayout) getLayout();
   for (Component component : getComponents()) {
     int cellSize = Math.max(getWidth(), getHeight());
     component.setSize(cellSize / layout.getColumns(), cellSize / layout.getRows());
     ((JLabel) component)
         .setFont(((JLabel) component).getFont().deriveFont((float) cellSize / layout.getRows()));
   }
 }
 /**
  * This method initializes this
  *
  * @return void
  */
 private void initialize() {
   this.setSize(400, (1) * 30);
   java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated
   layGridLayout.setColumns(1);
   layGridLayout.setRows(1); // Generated
   this.setLayout(layGridLayout); // Generated
   this.add(getJPanelseconds(), null); // Generated
   initActions();
 }
 /**
  * This method initializes this
  *
  * @return void
  */
 private void initialize() {
   this.setSize(400, (4) * 30);
   java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated
   layGridLayout.setRows(4); // Generated
   this.setLayout(layGridLayout); // Generated
   this.add(getJPanelstatic_(), null); // Generated
   this.add(getJPanelwriteprotect(), null); // Generated
   this.add(getJPanelautofallthrough(), null); // Generated
   this.add(getJPanelclearglobalvars(), null); // Generated
 }
Esempio n. 19
0
  void addBooleanComponent(String name, boolean currentValue) {
    configGridLayout.setRows(configGridLayout.getRows() + 1);
    addConfigLabel(name);

    JCheckBox checkBox = new JCheckBox();
    checkBox.setSelected(currentValue);

    componentByName.put(name, checkBox);
    configPanel.add(checkBox);
  }
Esempio n. 20
0
  void addTextBox(String name, String currentValue) {
    configGridLayout.setRows(configGridLayout.getRows() + 1);
    addConfigLabel(name);

    JTextField textField = new JTextField();
    textField.setText(currentValue);

    componentByName.put(name, textField);
    configPanel.add(textField);
  }
Esempio n. 21
0
  public void buildGUI() {
    theFrame = new JFrame("Cyber BeatBox");
    theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    BorderLayout layout = new BorderLayout();
    JPanel background = new JPanel(layout);
    background.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    checkboxList = new ArrayList<JCheckBox>();
    Box buttonBox = new Box(BoxLayout.Y_AXIS);

    JButton start = new JButton("Start");
    start.addActionListener(new MyStartListener());
    buttonBox.add(start);

    JButton stop = new JButton("Stop");
    stop.addActionListener(new MyStopListener());
    buttonBox.add(stop);

    JButton upTempo = new JButton("Tempo Up");
    upTempo.addActionListener(new MyUpTempoListener());
    buttonBox.add(upTempo);

    JButton downTempo = new JButton("Tempo Down");
    downTempo.addActionListener(new MyDownTempoListener());
    buttonBox.add(downTempo);

    Box nameBox = new Box(BoxLayout.Y_AXIS);
    for (int i = 0; i < 16; i++) {
      nameBox.add(new Label(instrumentNames[i]));
    }

    background.add(BorderLayout.EAST, buttonBox);
    background.add(BorderLayout.WEST, nameBox);

    theFrame.getContentPane().add(background);

    GridLayout grid = new GridLayout(16, 16);
    grid.setVgap(1);
    grid.setHgap(2);
    mainPanel = new JPanel(grid);
    background.add(BorderLayout.CENTER, mainPanel);

    for (int i = 0; i < 256; i++) {
      JCheckBox c = new JCheckBox();
      c.setSelected(false);
      checkboxList.add(c);
      mainPanel.add(c);
    } // end loop

    setUpMidi();

    theFrame.setBounds(50, 50, 300, 300);
    theFrame.pack();
    theFrame.setVisible(true);
  } // close method
Esempio n. 22
0
  public ListarHisClientes(Frame padre) {

    super((Frame) padre, true);
    try {
      // this.cod_cli=cod_cli;
      lblNombre = new JLabel();
      lblNombre.setText("Nombre:");
      lblNombre.setBounds(17, 15, 48, 16);
      txtNombre = new JTextField();
      txtNombre.setBounds(77, 13, 323, 20);

      pnlArriba = new JPanel();

      pnlAbajo = new JPanel();
      GridLayout pnlAbajoLayout = new GridLayout(1, 1);
      pnlAbajoLayout.setHgap(5);
      pnlAbajoLayout.setVgap(5);
      pnlAbajoLayout.setColumns(1);
      pnlAbajo.setLayout(pnlAbajoLayout);
      getContentPane().add(pnlAbajo, BorderLayout.CENTER);
      pnlAbajo.setPreferredSize(new java.awt.Dimension(859, 429));

      getContentPane().add(pnlArriba, BorderLayout.NORTH);
      pnlArriba.setPreferredSize(new java.awt.Dimension(892, 42));
      pnlArriba.setLayout(null);
      pnlArriba.add(lblNombre);
      pnlArriba.add(txtNombre);

      btnBuscar = new JButton();
      pnlArriba.add(btnBuscar);
      btnBuscar.setText("Buscar");
      btnBuscar.setBounds(325, 10, 81, 26);
      btnBuscar.setVisible(false);
      btnBuscar.addActionListener(this);

      jPanel1 = new JPanel();
      getContentPane().add(jPanel1, BorderLayout.SOUTH);
      jPanel1.setPreferredSize(new java.awt.Dimension(412, 5));

      jScrollPane1 = new JScrollPane();
      pnlAbajo.add(jScrollPane1);
      jScrollPane1.setPreferredSize(new java.awt.Dimension(859, 467));

      jTable1 = new JTable();
      jScrollPane1.setViewportView(jTable1);
      jTable1.setModel(modelo2);
      jTable1.addMouseListener(this);

      this.setSize(428, 266);
      getNombre(ConfigurarCuentas.cod_cli);
      listarXcod(ConfigurarCuentas.cod_cli);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 23
0
 /**
  * This method initializes jContentPane
  *
  * @return javax.swing.JPanel
  */
 private JPanel getJContentPane() {
   if (jContentPane == null) {
     GridLayout gridLayout = new GridLayout();
     gridLayout.setRows(1);
     gridLayout.setColumns(2);
     jContentPane = new JPanel();
     jContentPane.setLayout(gridLayout);
     jContentPane.add(getJPanel1(), null);
     jContentPane.add(getJPanel(), null);
   }
   return jContentPane;
 }
Esempio n. 24
0
 /**
  * This method initializes this
  *
  * @return void
  */
 private void initialize() {
   this.setSize(400, (4) * 30);
   java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated
   layGridLayout.setColumns(1);
   layGridLayout.setRows(4); // Generated
   this.setLayout(layGridLayout); // Generated
   this.add(getJPanelfamily(), null); // Generated
   this.add(getJPanelcolmatch(), null); // Generated
   this.add(getJPanelvalue(), null); // Generated
   this.add(getJPanelprefix(), null); // Generated
   initActions();
 }
Esempio n. 25
0
 protected JComponent createButtonPanel() {
   GridLayout gridLayout = new GridLayout();
   JPanel jPanelButtons = new JPanel();
   jPanelButtons.setLayout(gridLayout);
   gridLayout.setRows(1);
   gridLayout.setHgap(10);
   gridLayout.setVgap(5);
   gridLayout.setColumns(buttons.length);
   for (int i = 0; i < buttons.length; i++) {
     jPanelButtons.add(buttons[i]);
   }
   return jPanelButtons;
 }
  private void addImageOptions(final Container pane) {

    GridLayout layout = new GridLayout(0, 2);

    layout.setVgap(GAP);

    final JPanel panel = new JPanel();
    pane.add(panel, BorderLayout.NORTH);

    panel.setLayout(layout);
    layout.layoutContainer(panel);

    panel.setBorder(BorderFactory.createTitledBorder("Image Options:"));

    panel.add(new JLabel("Synapse Type:"));
    for (Display2DOptions.SynapseType type : Display2DOptions.SynapseType.getValues()) {
      synapsesCombo.addItem(type.getLabel());
    }
    synapsesCombo.setSelectedIndex(
        Display2DOptions.SynapseType.getIndex(Elegance.display2DOptions.getSynapseType()));

    panel.add(synapsesCombo);

    panel.add(new JLabel("Display Type:"));
    for (String dtypeStr : ALL_D_TYPES) {
      dtypeCombo.addItem(dtypeStr);
    }
    panel.add(dtypeCombo);

    dtypeCombo.setSelectedIndex(
        Arrays.asList(ALL_D_TYPES).indexOf(Elegance.display2DOptions.getDtype()));

    panel.add(new JLabel("Zoom:"));
    for (String zoomStr : ALL_ZOOMS) {
      zoomCombo.addItem(zoomStr);
    }
    panel.add(zoomCombo);
    zoomCombo.setSelectedIndex(
        Arrays.asList(ALL_ZOOMS).indexOf(Elegance.display2DOptions.getZoom() + ""));

    panel.add(new JLabel("Neurons To Connect: (ex. 10:20, 21:35)"));
    panel.add(neurons2ConnectInput);

    if (Elegance.display2DOptions.getNeurons2Connect() != null) {
      List<String> str = new ArrayList<String>();
      for (Display2DOptions.NeuronPair pair : Elegance.display2DOptions.getNeurons2Connect()) {
        str.add(pair.getFromId() + ":" + pair.getToId());
      }
      neurons2ConnectInput.setText(EString.join(str, ","));
    }
  }
Esempio n. 27
0
  // table
  public void defineMiddlePanel() {
    middle = new JPanel();
    middle.setBackground(GuiControl.FILLER_COLOR);
    middle.setLayout(new FlowLayout(FlowLayout.CENTER));
    JPanel gridPanel = new JPanel();
    gridPanel.setBackground(GuiControl.SCREEN_BACKGROUND);
    middle.add(gridPanel);
    GridLayout gl = new GridLayout(5, 2);
    gl.setHgap(8);
    gl.setVgap(8);
    gridPanel.setLayout(gl);
    gridPanel.setBorder(new WindowBorder(GuiControl.WINDOW_BORDER));

    // add fields
    String[] fldNames = DefaultData.FIELD_NAMES;

    String labelName = fldNames[DefaultData.PRODUCT_NAME_INT];
    makeLabel(gridPanel, labelName);
    productNameField = new JTextField(10);
    productNameField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(productNameField);

    // catalog group is different from the other fields
    // because it plays a different role in MaintainCatalog
    // so it is set differently
    labelName = "Catalog";
    makeLabel(gridPanel, labelName);
    catalogGroupField = new JComboBox();
    catalogGroupField.addItem(DefaultData.BOOKS);
    catalogGroupField.addItem(DefaultData.CLOTHES);
    catalogGroupField.setSelectedItem(catalogGroup);
    gridPanel.add(catalogGroupField);

    labelName = fldNames[DefaultData.PRICE_PER_UNIT_INT];
    makeLabel(gridPanel, labelName);
    pricePerUnitField = new JTextField(10);
    pricePerUnitField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(pricePerUnitField);

    labelName = fldNames[DefaultData.MFG_DATE_INT];
    makeLabel(gridPanel, labelName);
    mfgDateField = new JTextField(10);
    mfgDateField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(mfgDateField);

    labelName = fldNames[DefaultData.QUANTITY_INT];
    makeLabel(gridPanel, labelName);
    quantityField = new JTextField(10);
    quantityField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(quantityField);
  }
  // populate version for corrections
  public void showCorrectionTokenUpgrades(MapCorrectionAction action) {
    // activate correctionTokenMode and deactivate standard tokenMode
    correctionTokenMode = true;
    tokenMode = false;

    // activate upgrade panel
    upgradePanel.removeAll();
    GridLayout panelLayout = (GridLayout) upgradePanel.getLayout();
    List<? extends TokenI> tokens = orUIManager.tokenLays;

    if (tokens == null || tokens.size() == 0) {
      // reset to the number of elements
      panelLayout.setRows(defaultNbPanelElements);
      // set to position 0
      scrollPane.getVerticalScrollBar().setValue(0);
    } else {
      Color fgColour = null;
      Color bgColour = null;
      String text = null;
      String description = null;
      TokenIcon icon;
      CorrectionTokenLabel tokenLabel;
      correctionTokenLabels = new ArrayList<CorrectionTokenLabel>();
      for (TokenI token : tokens) {
        if (token instanceof BaseToken) {
          PublicCompanyI comp = ((BaseToken) token).getCompany();
          fgColour = comp.getFgColour();
          bgColour = comp.getBgColour();
          description = text = comp.getName();
        }
        icon = new TokenIcon(25, fgColour, bgColour, text);
        tokenLabel = new CorrectionTokenLabel(icon, token);
        tokenLabel.setName(description);
        tokenLabel.setText(description);
        tokenLabel.setBackground(defaultLabelBgColour);
        tokenLabel.setOpaque(true);
        tokenLabel.setVisible(true);
        tokenLabel.setBorder(border);
        tokenLabel.addMouseListener(this);
        tokenLabel.addPossibleAction(action);
        correctionTokenLabels.add(tokenLabel);
        upgradePanel.add(tokenLabel);
      }
    }
    upgradePanel.add(doneButton);
    upgradePanel.add(cancelButton);

    //      repaint();
    revalidate();
  }
  // populate version for corrections
  public void showCorrectionTileUpgrades() {
    // deactivate correctionTokenMode and tokenmode
    correctionTokenMode = false;
    tokenMode = false;

    // activate upgrade panel
    upgradePanel.removeAll();
    GridLayout panelLayout = (GridLayout) upgradePanel.getLayout();
    List<TileI> tiles = orUIManager.tileUpgrades;

    if (tiles == null || tiles.size() == 0) {
      // reset to the number of elements
      panelLayout.setRows(defaultNbPanelElements);
      // set to position 0
      scrollPane.getVerticalScrollBar().setValue(0);
    } else {
      // set to the max of available or the default number of elements
      panelLayout.setRows(Math.max(tiles.size() + 2, defaultNbPanelElements));
      for (TileI tile : tiles) {

        BufferedImage hexImage = getHexImage(tile.getId());
        ImageIcon hexIcon = new ImageIcon(hexImage);

        // Cheap n' Easy rescaling.
        hexIcon.setImage(
            hexIcon
                .getImage()
                .getScaledInstance(
                    (int) (hexIcon.getIconWidth() * GUIHex.NORMAL_SCALE * 0.8),
                    (int) (hexIcon.getIconHeight() * GUIHex.NORMAL_SCALE * 0.8),
                    Image.SCALE_SMOOTH));

        HexLabel hexLabel = new HexLabel(hexIcon, tile.getId());
        hexLabel.setName(tile.getName());
        hexLabel.setTextFromTile(tile);
        hexLabel.setOpaque(true);
        hexLabel.setVisible(true);
        hexLabel.setBorder(border);
        hexLabel.addMouseListener(this);

        upgradePanel.add(hexLabel);
      }
    }

    upgradePanel.add(doneButton);
    upgradePanel.add(cancelButton);

    //      repaint();
    revalidate();
  }
Esempio n. 30
-1
  public KrustyView() {
    content = new JFrame();
    content.setLayout(new RiverLayout());
    JLabel searchTerm = new JLabel("Search: ");
    content.add(searchTerm);
    this.inputText = new JTextField("", 20);
    content.add("left", inputText);
    JLabel fromDateLabel = new JLabel("From date: ");
    content.add(fromDateLabel);
    this.fromDate = new JTextField("", 6);
    content.add(fromDate);

    JLabel toDateLabel = new JLabel("To date: ");
    content.add(toDateLabel);
    this.toDate = new JTextField("", 6);
    content.add(toDate);

    for (String s : searchDescription) {
      searchCombo.addItem(s);
    }
    content.add("tab", searchCombo);
    this.searchButton = new JButton("Search");
    content.add("tab", searchButton);

    GridLayout outputLayout = new GridLayout(0, 2);
    outputLayout.setHgap(10);
    JPanel outputPanel = new JPanel(outputLayout);
    content.add("p hfill vfill", outputPanel);

    searchOutput = new JTextArea();
    searchOutput.setEditable(false);
    TitledBorder searchTitle;
    searchTitle = BorderFactory.createTitledBorder("Search results");
    searchTitle.setTitleJustification(TitledBorder.RIGHT);
    searchOutput.setBorder(searchTitle);
    searchOutput.setLineWrap(true);
    outputPanel.add(new JScrollPane(searchOutput));
    productionOutput = new JTextArea();
    productionOutput.setEditable(false);
    TitledBorder productionTitle;
    productionTitle = BorderFactory.createTitledBorder("Production status");
    productionTitle.setTitleJustification(TitledBorder.RIGHT);
    productionOutput.setBorder(productionTitle);
    productionOutput.setLineWrap(true);
    outputPanel.add(new JScrollPane(productionOutput));

    this.blockedTrue = new JButton("Blocked");
    content.add("p", blockedTrue);
    this.blockedFalse = new JButton("Not blocked");
    content.add("", blockedFalse);

    content.setSize(1024, 768);
    content.setTitle("Krusty Kookies");
    content.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    content.setVisible(true);
    content.setResizable(false);
  }