public SoDTransformerDialog() {
    setTitle("New SoD-Property Transformer");
    setBounds(100, 100, 300, 288);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(null);
    {
      JLabel lblPetriNet = new JLabel("Name:");
      lblPetriNet.setHorizontalAlignment(SwingConstants.TRAILING);
      lblPetriNet.setBounds(19, 23, 61, 16);
      contentPanel.add(lblPetriNet);
    }
    {
      JLabel lblTraverser = new JLabel("Violation:");
      lblTraverser.setHorizontalAlignment(SwingConstants.TRAILING);
      lblTraverser.setBounds(6, 53, 74, 16);
      contentPanel.add(lblTraverser);
    }
    {
      JLabel lblPasses = new JLabel("Separation activities:");
      lblPasses.setHorizontalAlignment(SwingConstants.TRAILING);
      lblPasses.setBounds(20, 105, 131, 16);
      contentPanel.add(lblPasses);
    }

    txtSodTransformer = new JTextField();
    txtSodTransformer.setText("SoD-Transformer 01");
    txtSodTransformer.setBounds(85, 17, 183, 28);
    contentPanel.add(txtSodTransformer);
    txtSodTransformer.setColumns(10);

    JSpinner spinner = new JSpinner();
    spinner.setBounds(85, 47, 111, 28);
    contentPanel.add(spinner);

    JLabel label = new JLabel("%");
    label.setBounds(202, 53, 17, 16);
    contentPanel.add(label);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBounds(19, 125, 198, 87);
    contentPanel.add(scrollPane);

    JList list = new JList();
    list.setModel(
        new AbstractListModel() {
          private static final long serialVersionUID = -4596249052603627042L;
          String[] values = new String[] {"Sign Contract", "Acknowledge"};

          public int getSize() {
            return values.length;
          }

          public Object getElementAt(int index) {
            return values[index];
          }
        });
    scrollPane.setViewportView(list);

    JButton btnAdd = new JButton("Add");
    btnAdd.setBounds(218, 125, 68, 29);
    contentPanel.add(btnAdd);

    JSeparator separator = new JSeparator();
    separator.setBounds(6, 86, 288, 12);
    contentPanel.add(separator);
    {
      JPanel buttonPane = new JPanel();
      buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
      {
        JButton okButton = new JButton("OK");
        okButton.setActionCommand("OK");
        buttonPane.add(okButton);
        getRootPane().setDefaultButton(okButton);
      }
      {
        JButton cancelButton = new JButton("Cancel");
        cancelButton.setActionCommand("Cancel");
        buttonPane.add(cancelButton);
      }
    }
    setVisible(true);
  }
예제 #2
0
  /** Create the panel. */
  public GuilncLocation() {
    setLayout(null);

    scrollPane = new JScrollPaneData();
    scrollPane.setBounds(12, 51, 572, 385);
    add(scrollPane);

    JButton btnAddfile = new JButton("addFile");
    btnAddfile.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            List<String> lsFile = guiFileOpen.openLsFileName("", "");
            List<String[]> lsFile2Result = new ArrayList<String[]>();
            for (String fileName : lsFile) {
              String[] tmpResult = new String[2];
              tmpResult[0] = fileName;
              tmpResult[1] = FileOperate.changeFileSuffix(fileName, "_lncLocation", null);
              lsFile2Result.add(tmpResult);
            }
            scrollPane.addItemLs(lsFile2Result);
          }
        });
    btnAddfile.setBounds(596, 51, 107, 25);
    add(btnAddfile);

    JButton btnDelfile = new JButton("delFile");
    btnDelfile.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            scrollPane.deleteSelRows();
          }
        });
    btnDelfile.setBounds(596, 88, 107, 25);
    add(btnDelfile);

    guiLayeredPaneSpeciesVersionGff = new GuiLayeredPaneSpeciesVersionGff();
    guiLayeredPaneSpeciesVersionGff.setBounds(596, 125, 214, 137);
    add(guiLayeredPaneSpeciesVersionGff);

    JButton btnRun = new JButton("Run");
    btnRun.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            lncSiteInfo.setSpecies(guiLayeredPaneSpeciesVersionGff.getSelectSpecies());
            int colNum = (Integer) spinner.getValue() - 1;
            int colStart = 0, colEnd = 0;
            if (rdbtnByloc.isSelected()) {
              colStart = (Integer) spinStart.getValue() - 1;
              colEnd = (Integer) spinEnd.getValue() - 1;
            }
            try {
              lncSiteInfo.setUpDownExtend(Integer.parseInt(txtUpDownDistance.getText()));
            } catch (Exception e2) {
              // TODO: handle exception
            }

            for (String[] file2Result : scrollPane.getLsDataInfo()) {
              List<List<String>> lsInfo = ExcelTxtRead.readLsExcelTxtls(file2Result[0], 1);
              List<LncInfo> lsTmpResult = null;
              if (rdbtnByloc.isSelected()) {
                lncSiteInfo.setLsLncAligns(lsInfo, colNum, colStart, colEnd);
                lsTmpResult = lncSiteInfo.findLncInfoByLoc();
              } else {
                lncSiteInfo.setLsLncName(lsInfo, colNum);
                lsTmpResult = lncSiteInfo.findLncInfoByName();
              }

              TxtReadandWrite txtWrite = new TxtReadandWrite(file2Result[1], true);
              txtWrite.writefileln(LncInfo.getTitle());
              for (LncInfo lncInfo : lsTmpResult) {
                txtWrite.writefileln(lncInfo.toString());
              }
              txtWrite.close();
            }
          }
        });
    btnRun.setBounds(596, 411, 107, 25);
    add(btnRun);

    spinner = new JSpinner();
    spinner.setBounds(596, 379, 67, 20);
    spinner.setValue(1);
    add(spinner);

    lblLncidcol = new JLabel("LncIDCol");
    lblLncidcol.setBounds(596, 358, 92, 15);
    add(lblLncidcol);

    rdbtnByname = new JRadioButton("ByName");
    rdbtnByname.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setRdbtn(true);
          }
        });
    rdbtnByname.setSelected(true);
    rdbtnByname.setBounds(594, 271, 93, 26);
    add(rdbtnByname);

    rdbtnByloc = new JRadioButton("ByLoc");
    rdbtnByloc.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setRdbtn(false);
          }
        });
    rdbtnByloc.setBounds(701, 271, 81, 26);
    add(rdbtnByloc);

    spinStart = new JSpinner();
    spinStart.setBounds(707, 377, 59, 22);
    add(spinStart);

    lblStartcol = new JLabel("StartCol");
    lblStartcol.setBounds(707, 356, 59, 18);
    add(lblStartcol);

    spinEnd = new JSpinner();
    spinEnd.setBounds(778, 377, 52, 22);
    add(spinEnd);

    lblEndcol = new JLabel("EndCol");
    lblEndcol.setBounds(778, 356, 59, 18);
    add(lblEndcol);

    lblDistancetoupdowngene = new JLabel("DistanceToUpDownGene");
    lblDistancetoupdowngene.setBounds(602, 305, 208, 18);
    add(lblDistancetoupdowngene);

    txtUpDownDistance = new JTextField();
    txtUpDownDistance.setText("10000");
    txtUpDownDistance.setBounds(599, 324, 67, 22);
    add(txtUpDownDistance);
    txtUpDownDistance.setColumns(10);

    initial();
  }
예제 #3
0
  @SuppressWarnings("deprecation")
  NPCPane(SpritesNPCManager mgr, int NPCIndex) {
    myIndex = NPCIndex;
    setBorder(new TitledBorder(null, "NPC", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    lblSpriteSet = new JLabel("Spriteset:");
    add(lblSpriteSet);
    lblSpriteSet.setBounds(10, 38, lblSpriteSet.getText().length() * 8, 16);
    Rectangle r = lblSpriteSet.getBounds();
    txtSpriteSet = new JSpinner(new SpinnerNumberModel(0, 0, 255, 1));
    txtSpriteSet.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            Save(MapIO.loadedMap.mapNPCManager);
          }
        });
    add(txtSpriteSet);
    txtSpriteSet.setBounds(90, 38, 87, 16);
    // txtSpriteSet.disable();

    lblBehavior1 = new JLabel("Behavior1:");
    add(lblBehavior1);
    lblBehavior1.setBounds(10, 54, lblBehavior1.getText().length() * 8, 16);
    r = lblBehavior1.getBounds();
    txtBehavior1 = new JTextField();
    txtBehavior1.setColumns(2);
    add(txtBehavior1);
    txtBehavior1.setBounds(90, 54, 32, 16);

    lblBehavior2 = new JLabel("Behavior2:");
    add(lblBehavior2);
    lblBehavior2.setBounds(10, 70, lblBehavior2.getText().length() * 8, 16);
    r = lblBehavior2.getBounds();
    txtBehavior2 = new JTextField();
    txtBehavior2.setColumns(2);
    add(txtBehavior2);
    txtBehavior2.setBounds(90, 70, 64, 16);

    lblIsTrainer = new JLabel("Is a Trainer:");
    add(lblIsTrainer);
    lblIsTrainer.setBounds(10, 86, lblIsTrainer.getText().length() * 8, 16);
    r = lblIsTrainer.getBounds();
    chkIsTrainer = new JCheckBox();
    add(chkIsTrainer);
    chkIsTrainer.setBounds(114, 86, 32, 16);

    lblTrainerLOS = new JLabel("TrainerLOS:");
    add(lblTrainerLOS);
    lblTrainerLOS.setBounds(10, 102, lblTrainerLOS.getText().length() * 8, 16);
    r = lblTrainerLOS.getBounds();
    txtTrainerLOS = new JTextField();
    txtTrainerLOS.setColumns(3);
    add(txtTrainerLOS);
    txtTrainerLOS.setBounds(90, 102, 32, 16);

    lbliFlag = new JLabel("NPC Flag:");
    add(lbliFlag);
    lbliFlag.setBounds(10, 128, 88, 16);

    txtiFlag = new JTextField();
    txtiFlag.setColumns(4);
    add(txtiFlag);
    txtiFlag.setText("0");
    txtiFlag.setBounds(90, 128, 32, 16);

    lblScript = new JLabel("NPC Script Pointer:");
    add(lblScript);
    lblScript.setBounds(10, 150, 88, 16);

    txtScript = new JTextField();
    txtScript.setColumns(9);
    add(txtScript);
    txtScript.setText("0");
    txtScript.setBounds(90, 150, 32, 16);

    JButton btnSave = new JButton("Save");
    btnSave.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            Save(MapIO.loadedMap.mapNPCManager);
          }
        });
    add(btnSave);
    btnSave.setBounds(55, 163, 89, 23);
    Load(mgr, NPCIndex);
  }
  // create and position GUI components; register event handlers
  private void createUserInterface() {
    // get content pane for attaching GUI components
    Container contentPane = getContentPane();

    // enable explicit positioning of GUI components
    contentPane.setLayout(null);

    // set up principalJLabel
    principalJLabel = new JLabel();
    principalJLabel.setBounds(16, 16, 56, 24);
    principalJLabel.setText("Principal:");
    contentPane.add(principalJLabel);

    // set up principalJTextField
    principalJTextField = new JTextField();
    principalJTextField.setBounds(100, 16, 100, 24);
    principalJTextField.setHorizontalAlignment(JTextField.RIGHT);
    contentPane.add(principalJTextField);

    // set up interestRateJLabel
    interestRateJLabel = new JLabel();
    interestRateJLabel.setBounds(16, 56, 80, 24);
    interestRateJLabel.setText("Interest rate:");
    contentPane.add(interestRateJLabel);

    // set up interestRateJTextField
    interestRateJTextField = new JTextField();
    interestRateJTextField.setBounds(100, 56, 100, 24);
    interestRateJTextField.setHorizontalAlignment(JTextField.RIGHT);
    contentPane.add(interestRateJTextField);

    // set up yearsJLabel
    yearsJLabel = new JLabel();
    yearsJLabel.setBounds(16, 96, 48, 24);
    yearsJLabel.setText("Years:");
    contentPane.add(yearsJLabel);

    // set up yearsJSpinner
    yearsJSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 10, 1));
    yearsJSpinner.setBounds(100, 96, 100, 24);
    contentPane.add(yearsJSpinner);

    // set up yearlyBalanceJLabel
    yearlyBalanceJLabel = new JLabel();
    yearlyBalanceJLabel.setBounds(16, 136, 150, 24);
    yearlyBalanceJLabel.setText("Yearly account balance:");
    contentPane.add(yearlyBalanceJLabel);

    // set up yearlyBalanceJTextArea
    yearlyBalanceJTextArea = new JTextArea();
    yearlyBalanceJTextArea.setEditable(false);

    // set up yearlyBalanceJScrollPane
    yearlyBalanceJScrollPane = new JScrollPane(yearlyBalanceJTextArea);
    yearlyBalanceJScrollPane.setBounds(16, 160, 300, 92);
    contentPane.add(yearlyBalanceJScrollPane);

    // set up calculateJButton
    calculateJButton = new JButton();
    calculateJButton.setBounds(216, 16, 100, 24);
    calculateJButton.setText("Calculate");
    contentPane.add(calculateJButton);
    calculateJButton.addActionListener(
        new ActionListener() // anonymous inner class
        {
          // event handler called when calculateJButton is clicked
          public void actionPerformed(ActionEvent event) {
            calculateJButtonActionPerformed(event);
          }
        } // end anonymous inner class
        ); // end call to addActionListener

    // set properties of application's window
    setTitle("Interest Calculator"); // set title bar text
    setSize(340, 296); // set window size
    setVisible(true); // display window
  } // end method createUserInterface
예제 #5
0
    ModiPanel(MemberPane mp, BusinessPane bp) {
      this.member_pane = mp;
      this.busi_pane = bp;
      setLayout(null);
      add(member_title);
      member_title.setBounds(20, 10, 80, 20);
      add(member_id);
      member_id.setBounds(20, 35, 80, 20);
      add(member_name);
      member_name.setBounds(20, 60, 80, 20);
      add(member_tele);
      member_tele.setBounds(20, 85, 80, 20);
      add(member_level);
      member_level.setBounds(20, 110, 80, 20);
      add(member_bal);
      member_bal.setBounds(20, 135, 80, 20);
      add(text_id);
      text_id.setBounds(100, 35, 180, 20);
      add(text_name);
      text_name.setBounds(100, 60, 180, 20);
      add(text_tele);
      text_tele.setBounds(100, 85, 180, 20);
      /*add(text_level);
      text_level.setBounds(100,90,180,20);*/
      add(text_bal);
      text_bal.setBounds(100, 135, 180, 20);
      add(spinner_level);
      spinner_level.setBounds(100, 110, 180, 20);

      add(trans_title);
      trans_title.setBounds(20, 220, 80, 20);
      add(trans_member);
      trans_member.setBounds(20, 245, 80, 20);
      add(trans_money);
      trans_money.setBounds(20, 270, 80, 20);
      add(text_member);
      text_member.setBounds(100, 245, 180, 20);
      add(text_money);
      text_money.setBounds(100, 270, 180, 20);

      add(button_add);
      button_add.setBounds(100, 165, 100, 25);
      button_add.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              try {
                System.out.println("add");
                mm.addMember(
                    text_id.getText(),
                    text_name.getText(),
                    text_tele.getText(),
                    spinner_level.getValue().toString(),
                    text_bal.getText());
                member_pane.update_table();
              } catch (Exception ex) {
                JOptionPane.showMessageDialog(
                    mainFrame, "Adding Failure!", "ERROR", JOptionPane.ERROR_MESSAGE);
              }

              // dialog_send.setVisible(false);
            }
          });

      add(button_add_trans);
      button_add_trans.setBounds(100, 305, 100, 25);
      button_add_trans.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              try {
                System.out.println("add transaction");
                Business busi =
                    new Business(
                        text_member.getText(), Float.valueOf(text_money.getText()).floatValue());
                busi.addBusi();
                busi_pane.update_table();
              } catch (Exception ex) {
                JOptionPane.showMessageDialog(
                    mainFrame, "Adding Failure!", "ERROR", JOptionPane.ERROR_MESSAGE);
              }

              // dialog_send.setVisible(false);
            }
          });

      // set font;
      member_title.setFont(font_title);
      member_id.setFont(font);
      member_name.setFont(font);
      member_tele.setFont(font);
      member_level.setFont(font);
      member_bal.setFont(font);
      button_add.setFont(font);
      trans_title.setFont(font_title);
      trans_member.setFont(font);
      trans_money.setFont(font);
      button_add_trans.setFont(font);
    }
예제 #6
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmMaker = new JFrame();
    frmMaker.setTitle("ThulikaMaker");
    frmMaker.setBounds(100, 100, 564, 637);
    frmMaker.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    fcOpen = new JFileChooser();
    fcOpen.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fcSave = new JFileChooser();
    fcSave.setFileSelectionMode(JFileChooser.FILES_ONLY);
    frmMaker.getContentPane().setLayout(new BorderLayout(0, 0));

    JLayeredPane layeredPane = new JLayeredPane();
    frmMaker.getContentPane().add(layeredPane, BorderLayout.NORTH);
    layeredPane.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblWidth = new JLabel("Width");
    layeredPane.add(lblWidth, "2, 2");

    widthBox = new JTextField();
    layeredPane.add(widthBox, "6, 2");
    widthBox.setColumns(10);

    JLabel lblHeight = new JLabel("Height");
    layeredPane.add(lblHeight, "2, 4");

    heightBox = new JTextField();
    layeredPane.add(heightBox, "6, 4");
    heightBox.setColumns(10);

    JButton btnLoadBundle = new JButton("Load Bundle");
    layeredPane.add(btnLoadBundle, "6, 6");
    final JFileChooser openBox;
    openBox = new JFileChooser();
    openBox.setFileSelectionMode(JFileChooser.FILES_ONLY);
    btnLoadBundle.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            int returnVal = fcOpen.showOpenDialog(frmMaker);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              File file = fcOpen.getSelectedFile();
              letterFilePath = file.getPath();
              trainer.loadLettersAction(
                  letterFilePath,
                  Integer.parseInt(widthBox.getText()),
                  Integer.parseInt(heightBox.getText()));
            } else {
              // nothing
            }
            charListBox.setListData(trainer.getCharSet().keySet().toArray());
            charListBox.setSelectedIndex(0);
          }
        });

    JLayeredPane layeredPane_1 = new JLayeredPane();
    frmMaker.getContentPane().add(layeredPane_1, BorderLayout.SOUTH);
    layeredPane_1.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblLanguageId = new JLabel("Language ID");
    layeredPane_1.add(lblLanguageId, "2, 2");

    langBox = new JTextField();
    layeredPane_1.add(langBox, "6, 2");
    langBox.setColumns(10);

    JButton btnSaveEngine = new JButton("Save Engine");
    layeredPane_1.add(btnSaveEngine, "6, 4");
    btnSaveEngine.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (letterFilePath == null || letterFilePath.isEmpty()) {
              JOptionPane.showMessageDialog(frmMaker, "Please load a file");
            } else {
              int returnVal = fcSave.showSaveDialog(frmMaker);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fcSave.getSelectedFile();
                try {
                  if (trainer.trainAndSave(file.getPath(), langBox.getText())) {
                    JOptionPane.showMessageDialog(frmMaker, "Engine saved!");
                  }
                } catch (IOException e) {
                  JOptionPane.showMessageDialog(frmMaker, e.getMessage());
                  e.printStackTrace();
                }
              } else {
                // nothing
              }
            }
          }
        });

    JLayeredPane layeredPane_2 = new JLayeredPane();
    frmMaker.getContentPane().add(layeredPane_2);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(165, 11, 102, 150);
    layeredPane_2.add(scrollPane);

    imageListBox = new JList();
    imageListBox.setFont(new Font("Kartika", Font.PLAIN, 11));
    imageListBox.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            // try {
            ImageFile iFile = (ImageFile) imageListBox.getSelectedValue();

            if (iFile == null) {
              imageListBox.setSelectedIndex(0);
              iFile = (ImageFile) imageListBox.getSelectedValue();
              if (iFile == null) {
                return;
              }
            }
            ImageData iData = iFile.getImageData();
            imageLabel.setIcon(
                new ImageIcon(
                    getImageFromArray(iData.getPixels(), iData.getWidth(), iData.getHeight())));
            imageLabel.setBounds(0, 0, iData.getWidth(), iData.getHeight());
            /*} catch (Exception e) {
            	// ignore
            }*/
          }
        });
    imageListBox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(imageListBox);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(277, 11, 261, 259);
    layeredPane_2.add(scrollPane_1);

    imageLabel = new JLabel("Image");
    scrollPane_1.setViewportView(imageLabel);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(9, 11, 102, 259);
    layeredPane_2.add(scrollPane_2);

    charListBox = new JList();
    scrollPane_2.setViewportView(charListBox);
    charListBox.setFont(new Font("Kartika", Font.PLAIN, 11));

    JLayeredPane layeredPane_3 = new JLayeredPane();
    layeredPane_3.setBounds(10, 295, 486, 142);
    layeredPane_2.add(layeredPane_3);

    JLabel lblSymbol = new JLabel("Symbol");
    lblSymbol.setBounds(10, 11, 46, 14);
    layeredPane_3.add(lblSymbol);

    JLabel lblAlign = new JLabel("Align");
    lblAlign.setBounds(10, 39, 46, 14);
    layeredPane_3.add(lblAlign);

    JLabel lblRules = new JLabel("Rules");
    lblRules.setBounds(10, 66, 46, 14);
    layeredPane_3.add(lblRules);

    symField = new JTextField();
    symField.setEditable(false);
    symField.setFont(new Font("Kartika", Font.PLAIN, 12));
    symField.setBounds(81, 5, 86, 20);
    layeredPane_3.add(symField);
    symField.setColumns(10);

    alignSelector = new JSpinner();
    alignSelector.setModel(new SpinnerNumberModel(0, -1, 1, 1));
    alignSelector.setBounds(81, 36, 29, 20);
    layeredPane_3.add(alignSelector);

    rulesBox = new JTextField();
    rulesBox.setFont(new Font("Kartika", Font.PLAIN, 12));
    rulesBox.setBounds(81, 64, 381, 20);
    layeredPane_3.add(rulesBox);
    rulesBox.setColumns(10);

    JButton btnSaveSymbol = new JButton("Save Symbol");
    btnSaveSymbol.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            CharData currentChar = (CharData) charListBox.getSelectedValue();
            currentChar.setAlign((Integer) alignSelector.getValue());
            Map<String, String> rules = getRules(rulesBox.getText());
            if (rules != null) {
              currentChar.setMergeRules(rules);
            }
            String alterStr = alterBox.getText();
            // String msg = setAlternativesList(currentChar, alterStr);
            // currentChar.setAlternatives(getAlternativesList(currentChar, alterStr));
            /*if(msg!=null && !msg.isEmpty()) {
            	JOptionPane.showMessageDialog(frmMaker,"Characters "+msg +" cannot be found");
            }*/
          }
        });
    btnSaveSymbol.setBounds(81, 95, 106, 23);
    layeredPane_3.add(btnSaveSymbol);

    JLabel lblAlternates = new JLabel("Alternates");
    lblAlternates.setBounds(234, 11, 60, 14);
    layeredPane_3.add(lblAlternates);

    alterBox = new JTextField();
    alterBox.setFont(new Font("Kartika", Font.PLAIN, 11));
    alterBox.setBounds(304, 8, 158, 20);
    layeredPane_3.add(alterBox);
    alterBox.setColumns(10);

    JButton btnDeleteFile = new JButton("Delete File");
    btnDeleteFile.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            String filename = ((ImageFile) imageListBox.getSelectedValue()).getFilename();
            if (trainer.deleteFile(filename)) {
              JOptionPane.showMessageDialog(frmMaker, "File " + filename + " is deleted");
            }
            try {
              populateImageData();
            } catch (Exception e) {
              imageListBox.clearSelection();
              charListBox.setSelectedIndex(0);
              charListBox.setListData(trainer.getCharSet().keySet().toArray());
            }
          }
        });
    btnDeleteFile.setBounds(165, 196, 89, 23);
    layeredPane_2.add(btnDeleteFile);
    charListBox.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            populateImageData();
          }
        });
  }
예제 #7
0
  /** Create the frame. */
  public MainFrame() {
    setResizable(false);
    setTitle("DCOPSolver");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 400, 299);

    JPopupMenu popupMenu = new JPopupMenu();
    addPopup(this, popupMenu);

    JMenuItem miSetSettings = new JMenuItem("设置");
    miSetSettings.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Settings.showSettingsDialog();
          }
        });
    popupMenu.add(miSetSettings);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    combobAgentType = new JComboBox();
    combobAgentType.setBounds(73, 52, 311, 32);
    contentPane.add(combobAgentType);

    JLabel lblAgenttype = new JLabel("AgentType");
    lblAgenttype.setBounds(10, 61, 65, 15);
    contentPane.add(lblAgenttype);

    cbDebug = new JCheckBox("Debug");
    cbDebug.setBounds(73, 99, 64, 23);
    contentPane.add(cbDebug);

    cbTreeFrame = new JCheckBox("Tree Frame");
    cbTreeFrame.setBounds(134, 99, 90, 23);
    contentPane.add(cbTreeFrame);

    JLabel lblSwitch = new JLabel("Switch");
    lblSwitch.setBounds(10, 103, 65, 15);
    contentPane.add(lblSwitch);

    combobProblem = new JComboBox();
    combobProblem.setBounds(73, 10, 311, 32);
    contentPane.add(combobProblem);

    JLabel lblProblem = new JLabel("Problem");
    lblProblem.setBounds(10, 19, 65, 15);
    contentPane.add(lblProblem);

    btnSolve = new JButton("Solve");
    btnSolve.setBounds(10, 199, 374, 62);
    contentPane.add(btnSolve);

    lbRunningFlag = new JLabel("New label");
    lbRunningFlag.setHorizontalAlignment(SwingConstants.CENTER);
    lbRunningFlag.setBounds(276, 82, 54, 56);
    contentPane.add(lbRunningFlag);

    // init
    File[] files = new File("problems/").listFiles();
    for (int i = 0; i < files.length; i++) {
      combobProblem.addItem(files[i].getName());
    }
    combobProblem.addItem("browse...");

    combobProblem.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            String selectedProblem = combobProblem.getSelectedItem() + "";
            if (selectedProblem.equals("browse...") == true) {
              String lastItem = combobProblem.getItemAt(combobProblem.getItemCount() - 1) + "";
              String defaultDir = "";
              if (lastItem.equals("browse...") == false) {
                defaultDir = lastItem.substring(0, lastItem.lastIndexOf('\\'));
              }
              File f =
                  DialogUtil.dialogOpenFile(new String[] {".xml"}, "Select A Problem", defaultDir);
              if (f != null) {
                if (lastItem.equals("browse...") == false) {
                  combobProblem.removeItemAt(combobProblem.getItemCount() - 1);
                }
                combobProblem.addItem(f.getPath());
                combobProblem.setSelectedIndex(combobProblem.getItemCount() - 1);
              } else {
                combobProblem.setSelectedIndex(0);
              }
            }
          }
        });

    String[] agentTypes = AgentManager.AGENT_TYPES;
    for (int i = 0; i < agentTypes.length; i++) {
      combobAgentType.addItem(agentTypes[i]);
    }

    btnSolve.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            try {
              solve();
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });

    lbRunningFlag.setText("");
    lbRunningFlag.setIcon(new ImageIcon("resources/loading.gif"));

    cbBatch = new JCheckBox("Batch");
    cbBatch.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            if (cbBatch.isSelected() == true) {
              File f =
                  DialogUtil.dialogOpenDir(
                      "Select Direcory",
                      tfDirPath.getText().isEmpty() ? "E:/" : tfDirPath.getText());
              if (f != null && f.isDirectory() == true) {
                enableBatch(true);
                tfDirPath.setText(f.getPath());
              } else {
                cbBatch.setSelected(false);
              }
            } else {
              enableBatch(false);
            }
          }
        });
    cbBatch.setBounds(322, 135, 62, 23);
    contentPane.add(cbBatch);

    tfDirPath = new JTextField();
    tfDirPath.setBounds(10, 168, 374, 21);
    contentPane.add(tfDirPath);
    tfDirPath.setColumns(10);

    labelBatCounter = new JLabel("0/0/0");
    labelBatCounter.setBounds(194, 139, 95, 15);
    contentPane.add(labelBatCounter);

    spinnerRepeatTimes = new JSpinner();
    spinnerRepeatTimes.setModel(new SpinnerNumberModel(5, 3, 10, 1));
    spinnerRepeatTimes.setBounds(73, 136, 65, 22);
    contentPane.add(spinnerRepeatTimes);

    JLabel lblTimes = new JLabel("times");
    lblTimes.setBounds(10, 139, 54, 15);
    contentPane.add(lblTimes);
    lbRunningFlag.setVisible(false);

    enableBatch(false);
  }
예제 #8
0
  /** Create the frame. */
  public copiaHoja() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 573, 481);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    sp1 = new JSpinner();
    sp1.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent arg0) {
            repaint();
          }
        });
    sp1.setModel(new SpinnerNumberModel(0, 0, 10, 1));
    sp1.setBounds(162, 51, 55, 28);
    contentPane.add(sp1);

    sp2 = new JSpinner();
    sp2.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            repaint();
          }
        });
    sp2.setModel(new SpinnerNumberModel(0, 0, 10, 1));
    sp2.setBounds(162, 150, 55, 28);
    contentPane.add(sp2);

    JLabel lblMargenInferior = new JLabel("Margen inferior");
    lblMargenInferior.setBounds(162, 26, 109, 14);
    contentPane.add(lblMargenInferior);

    JLabel lblMargenSuperior = new JLabel("Margen superior");
    lblMargenSuperior.setBounds(162, 127, 109, 14);
    contentPane.add(lblMargenSuperior);

    JLabel lblHoja = new JLabel("Hoja");
    lblHoja.setBounds(46, 26, 46, 14);
    contentPane.add(lblHoja);

    comboBox = new JComboBox();
    comboBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent arg0) {
            repaint();
          }
        });
    comboBox.setModel(new DefaultComboBoxModel(new String[] {"Horizontal", "Vertical"}));
    comboBox.setBounds(321, 55, 196, 20);
    contentPane.add(comboBox);

    JLabel lblHorientacinDePgina = new JLabel("Horientaciu00F3n de pu00E1gina.");
    lblHorientacinDePgina.setBounds(321, 26, 203, 14);
    contentPane.add(lblHorientacinDePgina);

    JButton btnInicializar = new JButton("Inicializar");
    btnInicializar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            sp1.setValue(0);
            sp2.setValue(0);
            comboBox.setSelectedIndex(0);
            repaint();
          }
        });
    btnInicializar.setBounds(45, 247, 165, 23);
    contentPane.add(btnInicializar);
  }
  private void initGUI() {
    try {
      this.setPreferredSize(new java.awt.Dimension(471, 531));
      this.setBounds(0, 0, 642, 304);
      setVisible(true);
      this.setIconifiable(true);
      this.setClosable(true);
      {
        jDesktopPane1 = new JDesktopPane();
        jDesktopPane1.setBackground(Color.WHITE);
        this.getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
        jDesktopPane1.setPreferredSize(new java.awt.Dimension(462, 497));
        jDesktopPane1.setLayout(null);

        jTextFieldSSCC = new JTextField4j();
        AbstractDocument doc = (AbstractDocument) jTextFieldSSCC.getDocument();
        doc.setDocumentFilter(new JFixedSizeFilter(JDBPallet.field_sscc));
        jTextFieldSSCC.addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyReleased(KeyEvent arg0) {
                refresh();
              }
            });
        jTextFieldSSCC.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                refresh();
              }
            });
        jDesktopPane1.add(jTextFieldSSCC);
        jTextFieldSSCC.setBounds(121, 24, 134, 21);

        jTextFieldNewSSCC = new JTextField4j();
        jDesktopPane1.add(jTextFieldNewSSCC);
        jTextFieldNewSSCC.setEditable(false);
        jTextFieldNewSSCC.setEnabled(false);
        jTextFieldNewSSCC.setBounds(121, 53, 134, 21);

        jFormattedTextFieldQuantity = new JQuantityInput(new BigDecimal("0"));
        jDesktopPane1.add(jFormattedTextFieldQuantity);
        jFormattedTextFieldQuantity.setFont(Common.font_std);
        jFormattedTextFieldQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        jFormattedTextFieldQuantity.setBounds(464, 24, 91, 21);
        jFormattedTextFieldQuantity.setVerifyInputWhenFocusTarget(false);
        jFormattedTextFieldQuantity.setEnabled(false);

        jFormattedTextFieldNewQuantity = new JQuantityInput(new BigDecimal("0"));
        jDesktopPane1.add(jFormattedTextFieldNewQuantity);
        jFormattedTextFieldNewQuantity.setFont(Common.font_std);
        jFormattedTextFieldNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        jFormattedTextFieldNewQuantity.setBounds(464, 53, 91, 21);
        jFormattedTextFieldNewQuantity.setVerifyInputWhenFocusTarget(false);
        jFormattedTextFieldNewQuantity.setEnabled(false);

        jFormattedTextFieldSplitQuantity = new JQuantityInput(new BigDecimal("0"));
        jDesktopPane1.add(jFormattedTextFieldSplitQuantity);
        jFormattedTextFieldSplitQuantity.setFont(Common.font_std);
        jFormattedTextFieldSplitQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        jFormattedTextFieldSplitQuantity.setBounds(269, 87, 91, 21);
        jFormattedTextFieldSplitQuantity.setVerifyInputWhenFocusTarget(false);

        labelSSCCQuantity = new JLabel4j_std();
        jDesktopPane1.add(labelSSCCQuantity);
        labelSSCCQuantity.setText(lang.get("lbl_Pallet_Quantity"));
        labelSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        labelSSCCQuantity.setBounds(369, 24, 88, 21);

        labelSSCCNewQuantity = new JLabel4j_std();
        jDesktopPane1.add(labelSSCCNewQuantity);
        labelSSCCNewQuantity.setText(lang.get("lbl_Pallet_Quantity"));
        labelSSCCNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        labelSSCCNewQuantity.setBounds(369, 53, 88, 21);

        labelNewSSCCQuantity = new JLabel4j_std();
        jDesktopPane1.add(labelNewSSCCQuantity);
        labelNewSSCCQuantity.setText(lang.get("lbl_Required_Quantity"));
        labelNewSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING);
        labelNewSSCCQuantity.setBounds(137, 86, 125, 21);

        jButtonSplit = new JButton4j(Common.icon_split);
        jButtonSplit.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                String splitSSCC =
                    pal.splitPallet(
                        jTextFieldSSCC.getText(),
                        new BigDecimal(jFormattedTextFieldSplitQuantity.getValue().toString()));
                if (splitSSCC.equals("") == false) {
                  lblStatus.setText(
                      "SSCC "
                          + jTextFieldSSCC.getText()
                          + " updated, SSCC "
                          + splitSSCC
                          + " created.");
                  jTextFieldNewSSCC.setText(splitSSCC);
                  jFormattedTextFieldNewQuantity.setValue(
                      jFormattedTextFieldSplitQuantity.getValue());
                  String pq = comboBoxPrintQueue.getSelectedItem().toString();
                  if (checkBoxPrintOldSSCC.isSelected()) {
                    buildSQL1Record(jTextFieldSSCC.getText());
                    JLaunchReport.runReport(
                        "RPT_PALLET_LABEL",
                        listStatement,
                        jCheckBoxAutoPreview.isSelected(),
                        pq,
                        Integer.valueOf(jSpinnerCopies.getValue().toString()),
                        checkBoxIncHeaderText.isSelected());
                  }
                  if (checkBoxPrintNewSSCC.isSelected()) {
                    buildSQL1Record(jTextFieldNewSSCC.getText());
                    JLaunchReport.runReport(
                        "RPT_PALLET_LABEL",
                        listStatement,
                        jCheckBoxAutoPreview.isSelected(),
                        pq,
                        Integer.valueOf(jSpinnerCopies.getValue().toString()),
                        checkBoxIncHeaderText.isSelected());
                  }
                } else {
                  JUtility.errorBeep();
                  JOptionPane.showMessageDialog(
                      Common.mainForm,
                      pal.getErrorMessage(),
                      lang.get("dlg_Error"),
                      JOptionPane.WARNING_MESSAGE);
                }
              }
            });

        jDesktopPane1.add(jButtonSplit);
        jButtonSplit.setText(lang.get("btn_Split"));
        jButtonSplit.setMnemonic(lang.getMnemonicChar());
        jButtonSplit.setBounds(151, 205, 111, 28);

        jButtonHelp = new JButton4j(Common.icon_help);
        jDesktopPane1.add(jButtonHelp);
        jButtonHelp.setText(lang.get("btn_Help"));
        jButtonHelp.setMnemonic(lang.getMnemonicChar());
        jButtonHelp.setBounds(265, 205, 111, 28);

        jButtonCancel = new JButton4j(Common.icon_close);
        jDesktopPane1.add(jButtonCancel);
        jButtonCancel.setText(lang.get("btn_Close"));
        jButtonCancel.setMnemonic(lang.getMnemonicChar());
        jButtonCancel.setBounds(378, 205, 111, 28);
        jButtonCancel.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                dispose();
              }
            });

        labelSSCC = new JLabel4j_std();
        jDesktopPane1.add(labelSSCC);
        labelSSCC.setText(lang.get("lbl_Source_SSCC"));
        labelSSCC.setBounds(6, 24, 103, 21);
        labelSSCC.setHorizontalAlignment(SwingConstants.TRAILING);

        labelNewSSCC = new JLabel4j_std();
        jDesktopPane1.add(labelNewSSCC);
        labelNewSSCC.setText(lang.get("lbl_Destination_SSCC"));
        labelNewSSCC.setBounds(18, 53, 91, 21);
        labelNewSSCC.setHorizontalAlignment(SwingConstants.TRAILING);

        JLabel4j_std labelHeader = new JLabel4j_std();
        labelHeader.setHorizontalAlignment(SwingConstants.TRAILING);
        labelHeader.setText(lang.get("lbl_Label_Header_Text"));
        labelHeader.setBounds(18, 112, 91, 21);
        jDesktopPane1.add(labelHeader);

        checkBoxIncHeaderText.setText("New JCheckBox");
        checkBoxIncHeaderText.setSelected(true);
        checkBoxIncHeaderText.setBackground(Color.WHITE);
        checkBoxIncHeaderText.setBounds(121, 112, 21, 21);
        jDesktopPane1.add(checkBoxIncHeaderText);

        JLabel4j_std labelQuantity = new JLabel4j_std();
        labelQuantity.setBounds(248, 112, 182, 21);
        labelQuantity.setHorizontalAlignment(SwingConstants.RIGHT);
        labelQuantity.setText(lang.get("lbl_Number_of_SSCCs"));
        jDesktopPane1.add(labelQuantity);

        JLabel4j_std labelCopies = new JLabel4j_std();
        labelCopies.setHorizontalAlignment(SwingConstants.RIGHT);
        labelCopies.setBounds(248, 141, 182, 21);
        labelCopies.setText(lang.get("lbl_Labels_Per_SSCC"));
        jDesktopPane1.add(labelCopies);

        jSpinnerQuantity.setEnabled(false);
        jSpinnerQuantity.setModel(
            new SpinnerNumberModel(new Integer(1), null, null, new Integer(1)));
        jSpinnerQuantity.setFont(Common.font_std);
        jSpinnerQuantity.setBounds(437, 112, 39, 21);
        JSpinner.NumberEditor ne = new JSpinner.NumberEditor(jSpinnerQuantity);
        ne.getTextField().setFont(Common.font_std);
        jSpinnerQuantity.setEditor(ne);
        jDesktopPane1.add(jSpinnerQuantity);

        jSpinnerCopies.setFont(Common.font_std);
        jSpinnerCopies.setBounds(437, 141, 39, 21);
        jSpinnerCopies.setInputVerifier(null);
        jSpinnerCopies.setModel(copiesnumbermodel);
        JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerCopies);
        nec2.getTextField().setFont(Common.font_std);
        jSpinnerCopies.setEditor(nec2);
        jDesktopPane1.add(jSpinnerCopies);

        JLabel4j_std label_3 = new JLabel4j_std(lang.get("lbl_Print_Queue"));
        label_3.setHorizontalAlignment(SwingConstants.TRAILING);
        label_3.setBounds(18, 174, 91, 21);
        jDesktopPane1.add(label_3);

        comboBoxPrintQueue.setSelectedIndex(-1);
        comboBoxPrintQueue.setBounds(121, 170, 471, 23);
        jDesktopPane1.add(comboBoxPrintQueue);

        jCheckBoxAutoPreview = new JCheckBox();
        jCheckBoxAutoPreview.setToolTipText("Auto SSCC");
        jCheckBoxAutoPreview.setText("New JCheckBox");
        jCheckBoxAutoPreview.setSelected(true);
        jCheckBoxAutoPreview.setEnabled(false);
        jCheckBoxAutoPreview.setBackground(Color.WHITE);
        jCheckBoxAutoPreview.setBounds(121, 141, 21, 21);
        jCheckBoxAutoPreview.setEnabled(
            Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_PRODDEC_PREVIEW"));
        jDesktopPane1.add(jCheckBoxAutoPreview);

        labelPreview = new JLabel4j_std();
        labelPreview.setBounds(18, 141, 91, 21);
        labelPreview.setHorizontalTextPosition(SwingConstants.CENTER);
        labelPreview.setHorizontalAlignment(SwingConstants.TRAILING);
        labelPreview.setText(lang.get("lbl_Preview"));
        jDesktopPane1.add(labelPreview);

        lblStatus.setForeground(Color.RED);
        lblStatus.setBackground(Color.GRAY);
        lblStatus.setBounds(2, 235, 610, 21);
        jDesktopPane1.add(lblStatus);

        JPanel panel = new JPanel();
        panel.setBackground(Color.WHITE);
        panel.setBorder(
            new TitledBorder(
                null, lang.get("btn_Print"), TitledBorder.CENTER, TitledBorder.TOP, null, null));
        panel.setBounds(270, 6, 90, 75);
        jDesktopPane1.add(panel);
        panel.setLayout(null);

        checkBoxPrintOldSSCC.setSelected(true);
        checkBoxPrintOldSSCC.setBounds(32, 17, 28, 23);
        panel.add(checkBoxPrintOldSSCC);

        checkBoxPrintNewSSCC.setSelected(true);
        checkBoxPrintNewSSCC.setBounds(32, 46, 28, 23);
        panel.add(checkBoxPrintNewSSCC);

        mod.setModuleId("RPT_PALLET_LABEL");
        mod.getModuleProperties();

        if (mod.getReportType().equals("Label")) {
          jCheckBoxAutoPreview.setSelected(false);
          jCheckBoxAutoPreview.setEnabled(false);

        } else {
          jSpinnerCopies.setVisible(false);
          labelCopies.setVisible(false);
        }
        populatePrinterList(JPrint.getDefaultPrinterQueueName());
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  private void jbInit() throws Exception {

    final JLabel textAndFont = new JLabel(Messages.getMessage("PdfViewerLabel.TextAndFont"));
    textAndFont.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    textAndFont.setDisplayedMnemonic('0');
    textAndFont.setBounds(new Rectangle(13, 13, 220, 26));

    final JLabel left = new JLabel(Messages.getMessage("PdfViewerLabel.Left"));
    left.setBounds(new Rectangle(130, 40, 50, 23));

    final JLabel center = new JLabel(Messages.getMessage("PdfViewerLabel.Center"));
    center.setBounds(new Rectangle(300, 40, 50, 23));

    final JLabel right = new JLabel(Messages.getMessage("PdfViewerLabel.Right"));
    right.setBounds(new Rectangle(475, 40, 50, 23));

    final JLabel header = new JLabel(Messages.getMessage("PdfViewerLabel.Header"));
    header.setBounds(new Rectangle(20, 60, 90, 23));

    final JLabel footer = new JLabel(Messages.getMessage("PdfViewerLabel.Footer"));
    footer.setBounds(new Rectangle(20, 90, 50, 23));

    leftHeaderBox.setBounds(new Rectangle(85, 60, 133, 23));
    centerHeaderBox.setBounds(new Rectangle(250, 60, 133, 23));
    rightHeaderBox.setBounds(new Rectangle(425, 60, 133, 23));

    leftFooterBox.setBounds(new Rectangle(85, 90, 133, 23));
    centerFooterBox.setBounds(new Rectangle(250, 90, 133, 23));
    rightFooterBox.setBounds(new Rectangle(425, 90, 133, 23));

    final JLabel font = new JLabel(Messages.getMessage("PdfViewerLabel.Font"));
    font.setBounds(new Rectangle(20, 120, 75, 23));

    fontsList.setBounds(new Rectangle(85, 120, 150, 23));
    fontsList.setSelectedItem("Helvetica");

    final JLabel size = new JLabel(Messages.getMessage("PdfViewerLabel.Size"));
    size.setBounds(new Rectangle(250, 120, 50, 23));

    fontSize.setBounds(new Rectangle(290, 120, 50, 23));

    final JLabel color = new JLabel(Messages.getMessage("PdfViewerLabel.Color"));
    color.setBounds(new Rectangle(360, 120, 50, 23));

    colorBox.setBackground(Color.black);
    colorBox.setOpaque(true);
    colorBox.setBounds(new Rectangle(410, 120, 23, 23));

    final JButton chooseColor = new JButton(Messages.getMessage("PdfViewerButton.ChooseColor"));
    chooseColor.setBounds(new Rectangle(450, 120, 160, 23));
    chooseColor.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            colorBox.setBackground(
                JColorChooser.showDialog(null, "Color", colorBox.getBackground()));
          }
        });

    tagsList.setText(
        "You may use the following\n"
            + "tags as part of the text.\n\n"
            + "<d> - Date in short format\n"
            + "<D> - Date in long format\n"
            + "<t> - Time in 12-hour format\n"
            + "<T> - Time in 24-hour format\n"
            + "<f> - Filename\n"
            + "<F> - Full path filename\n"
            + "<p> - Current page number\n"
            + "<P> - Total number of pages");
    tagsList.setOpaque(false);
    tagsList.setBounds(350, 160, 200, 210);

    final JLabel margins = new JLabel(Messages.getMessage("PdfViewerLabel.Margins"));

    margins.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    margins.setDisplayedMnemonic('0');
    margins.setBounds(new Rectangle(13, 150, 220, 26));

    final JLabel leftRight = new JLabel(Messages.getMessage("PdfViewerLabel.LeftAndRight"));
    leftRight.setBounds(new Rectangle(20, 185, 90, 23));

    leftRightBox.setBounds(new Rectangle(100, 185, 70, 23));

    final JLabel topBottom = new JLabel(Messages.getMessage("PdfViewerLabel.TopAndBottom"));
    topBottom.setBounds(new Rectangle(180, 185, 120, 23));

    topBottomBox.setBounds(new Rectangle(300, 185, 70, 23));

    pageRangeLabel.setText(Messages.getMessage("PdfViewerPageRange.text"));
    pageRangeLabel.setBounds(new Rectangle(13, 220, 400, 26));

    printAll.setText(Messages.getMessage("PdfViewerRadioButton.All"));
    printAll.setBounds(new Rectangle(23, 250, 75, 22));

    printCurrent.setText(Messages.getMessage("PdfViewerRadioButton.CurrentPage"));
    printCurrent.setBounds(new Rectangle(23, 270, 100, 22));
    printCurrent.setSelected(true);

    printPages.setText(Messages.getMessage("PdfViewerRadioButton.Pages"));
    printPages.setBounds(new Rectangle(23, 292, 70, 22));

    pagesBox.setBounds(new Rectangle(95, 292, 230, 22));
    pagesBox.addKeyListener(
        new KeyListener() {
          @Override
          public void keyPressed(final KeyEvent arg0) {}

          @Override
          public void keyReleased(final KeyEvent arg0) {
            if (pagesBox.getText().isEmpty()) {
              printCurrent.setSelected(true);
            } else {
              printPages.setSelected(true);
            }
          }

          @Override
          public void keyTyped(final KeyEvent arg0) {}
        });

    final JTextArea pagesInfo =
        new JTextArea(Messages.getMessage("PdfViewerMessage.PageNumberOrRangeLong"));
    pagesInfo.setBounds(new Rectangle(23, 320, 620, 40));
    pagesInfo.setOpaque(false);

    this.add(printAll, null);
    this.add(printCurrent, null);

    this.add(printPages, null);
    this.add(pagesBox, null);
    this.add(pagesInfo, null);

    this.add(left, null);
    this.add(center, null);
    this.add(right, null);
    this.add(header, null);
    this.add(footer, null);
    this.add(leftHeaderBox, null);
    this.add(centerHeaderBox, null);
    this.add(rightHeaderBox, null);
    this.add(leftFooterBox, null);
    this.add(centerFooterBox, null);
    this.add(rightFooterBox, null);
    this.add(font, null);
    this.add(fontsList, null);
    this.add(size, null);
    this.add(fontSize, null);
    this.add(color, null);
    this.add(colorBox, null);
    this.add(chooseColor, null);
    this.add(margins, null);
    this.add(leftRight, null);
    this.add(leftRightBox, null);
    this.add(topBottom, null);
    this.add(topBottomBox, null);

    this.add(textAndFont, null);
    this.add(changeButton, null);
    this.add(pageRangeLabel, null);

    // this.add(tagsList, null);

    this.add(jToggleButton2, null);
    this.add(jToggleButton3, null);

    buttonGroup1.add(printAll);
    buttonGroup1.add(printCurrent);
    buttonGroup1.add(printPages);
  }
예제 #11
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame("FVS ALGORITHM GURNIAK JEDYNAK");
    frame.setBounds(350, 150, 1215, 798);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));

    JPanel panel = new JPanel();
    frame.getContentPane().add(panel);
    panel.setLayout(new GridLayout(1, 0, 0, 0));

    textArea = new JTextArea();
    // panel.add( textArea );

    textArea.setEditable(false);
    JScrollPane scroll = new JScrollPane(textArea);
    scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    panel.add(scroll);

    JPanel panel_1 = new JPanel();
    panel.add(panel_1);
    panel_1.setLayout(new GridLayout(3, 1));

    JPanel panel_3 = new JPanel();
    panel_1.add(panel_3);
    panel_3.setLayout(new GridLayout(2, 1));

    JPanel panel_3a = new JPanel();
    panel_3a.setLayout(new GridLayout(3, 1));
    panel_3.add(panel_3a);

    JLabel lbChooseAlgorithm = new JLabel("Wybór algorytmu");
    lbChooseAlgorithm.setFont(new Font("Tahoma", Font.BOLD, 11));
    lbChooseAlgorithm.setHorizontalAlignment(SwingConstants.CENTER);
    panel_3a.add(lbChooseAlgorithm);

    chkBoxBruteForceAlgorithm = new JCheckBox("Algorytm Brute-force");
    chkBoxBruteForceAlgorithm.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent arg0) {
            if (chkBoxBruteForceAlgorithm.isSelected()) {
              // textArea.setText( "Wybrano algorytm Brute Force" );
              CommonVariables.getInstance().GENERUJ_ALGORYTM_BRUTE_FORCE = true;
            } else {
              // textArea.setText( "Nie wybrano algorytm Brute Force" );
              CommonVariables.getInstance().GENERUJ_ALGORYTM_BRUTE_FORCE = false;
            }
          }
        });

    /*        chkBoxBruteForceAlgorithm.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            if(chkBoxBruteForceAlgorithm.isSelected())
            {
                textArea.setText( "Wybrano algorytm Brute Force" );
            }else
            {
                textArea.setText( "Nie wybrano algorytm Brute Force" );
            }
        }
    });*/
    chkBoxBruteForceAlgorithm.setSelected(true);
    panel_3a.add(chkBoxBruteForceAlgorithm);

    chkBoxLayerAlgorithm = new JCheckBox("Algorytm warstwowy");
    chkBoxLayerAlgorithm.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (chkBoxLayerAlgorithm.isSelected()) {
              // textArea.setText( "Wybrano algorytm Warstwowy" );
              CommonVariables.getInstance().GENERUJ_ALGORYTM_WARSTWOWY = true;
            } else {
              // textArea.setText( "Nie wybrano algorytm Warstwowy" );
              CommonVariables.getInstance().GENERUJ_ALGORYTM_WARSTWOWY = false;
            }
          }
        });
    /*        chkBoxLayerAlgorithm.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if(chkBoxLayerAlgorithm.isSelected())
            {
                textArea.setText( "Wybrano algorytm Warstwowy" );
            }else
            {
                textArea.setText( "Nie wybrano algorytm Warstwowy" );
            }
        }
    });*/

    chkBoxLayerAlgorithm.setSelected(true);
    panel_3a.add(chkBoxLayerAlgorithm);

    JPanel panel_3b = new JPanel();
    panel_3.add(panel_3b);
    panel_3b.setLayout(new GridLayout(3, 1));

    JLabel lblNewLabel_1 = new JLabel("Typ pomiaru");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 11));
    lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
    panel_3b.add(lblNewLabel_1);

    chkBoxComputeComplexity = new JCheckBox("Czas wykonania");
    chkBoxComputeComplexity.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (chkBoxComputeComplexity.isSelected()) {
              // textArea.setText(
              // "Wybrano pomiar z³o¿onoœci obliczeniowej" );
              CommonVariables.getInstance().GENERUJ_POMIAR_ZLOZONOSCI_OBLICZENIOWEJ = true;
            } else {
              // textArea.setText(
              // "Nie wybrano pomiar z³o¿onoœci obliczeniowej" );
              CommonVariables.getInstance().GENERUJ_POMIAR_ZLOZONOSCI_OBLICZENIOWEJ = false;
            }
          }
        });

    chkBoxComputeComplexity.setSelected(true);
    panel_3b.add(chkBoxComputeComplexity);

    chkBoxComputeMemory = new JCheckBox("Z³o¿onoœæ pamiêciowa");
    chkBoxComputeMemory.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (chkBoxComputeMemory.isSelected()) {
              CommonVariables.getInstance().GENERUJ_POMIAR_ZLOZONOSCI_PAMIECIOWEJ = true;
            } else {
              CommonVariables.getInstance().GENERUJ_POMIAR_ZLOZONOSCI_PAMIECIOWEJ = false;
            }
          }
        });
    chkBoxComputeMemory.setEnabled(false);
    panel_3b.add(chkBoxComputeMemory);

    JPanel panel_10 = new JPanel();
    panel_10.setLayout(new GridLayout(4, 1));
    panel_1.add(panel_10);

    JPanel panel_5 = new JPanel();
    panel_10.add(panel_5);
    panel_5.setBounds(0, 2, 392, 45);

    JLabel lblNewLabel_2 = new JLabel("Ustawienia generatora");
    panel_5.add(lblNewLabel_2);
    lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
    lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 11));

    JPanel panel_7 = new JPanel();
    panel_10.add(panel_7);
    panel_7.setBounds(0, 137, 392, 45);
    panel_7.setLayout(null);

    JLabel label_1 = new JLabel("Liczba generowanych grafów");
    label_1.setBounds(206, 8, 183, 14);
    panel_7.add(label_1);

    tfNumberOfGraphs = new JTextField();
    tfNumberOfGraphs.setColumns(10);
    tfNumberOfGraphs.setBounds(10, 8, 48, 20);
    panel_7.add(tfNumberOfGraphs);
    tfNumberOfGraphs.setText(CommonVariables.getInstance().LICZBA_GENEROWANYCH_GRAFOW_W_SERII + "");

    JPanel panel_8 = new JPanel();
    panel_10.add(panel_8);
    panel_8.setLayout(new GridLayout(1, 3));

    rbRandomWeight = new JRadioButton("wagi losowe bez powtórzeñ");
    rbRandomWeight.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (rbRandomWeight.isSelected()) {
              // textArea.setText( "Wybrano wagê losow¹" );
              // CommonVariables.getInstance().CZY_WAGOWY = true;
              CommonVariables.getInstance().WAGI_ROWNE_JEDEN = false;
              CommonVariables.getInstance().WAGI_LOSOWE_BEZ_POWTORZEN = true;
              CommonVariables.getInstance().WAGI_LOSOWE_Z_POWTORZENIAMI = false;
            }
          }
        });
    panel_8.add(rbRandomWeight);
    rbRandomWeight.setSelected(true);
    rbRandomWeight.setHorizontalAlignment(SwingConstants.LEFT);

    rbStateWeight = new JRadioButton("wagi sta³e");
    rbStateWeight.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (rbStateWeight.isSelected()) {
              // textArea.setText( "Wybrano sta³¹ wagê" );
              CommonVariables.getInstance().WAGI_ROWNE_JEDEN = true;
              CommonVariables.getInstance().WAGI_LOSOWE_BEZ_POWTORZEN = false;
              CommonVariables.getInstance().WAGI_LOSOWE_Z_POWTORZENIAMI = false;
            }
          }
        });

    rdbtnWagiLosoweZ = new JRadioButton("wagi losowe z powtórzeniami");
    rdbtnWagiLosoweZ.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent arg0) {
            if (rdbtnWagiLosoweZ.isSelected()) {
              CommonVariables.getInstance().WAGI_ROWNE_JEDEN = false;
              CommonVariables.getInstance().WAGI_LOSOWE_BEZ_POWTORZEN = false;
              CommonVariables.getInstance().WAGI_LOSOWE_Z_POWTORZENIAMI = true;
            }
          }
        });
    panel_8.add(rdbtnWagiLosoweZ);
    panel_8.add(rbStateWeight);
    rbStateWeight.setHorizontalAlignment(SwingConstants.LEFT);

    ButtonGroup btButtonGroup = new ButtonGroup();
    btButtonGroup.add(rbRandomWeight);
    btButtonGroup.add(rbStateWeight);
    btButtonGroup.add(rdbtnWagiLosoweZ);

    JPanel panel_9 = new JPanel();
    panel_10.add(panel_9);
    panel_9.setLayout(new GridLayout(2, 1));

    lblNewLabel_4 = new JLabel("Gêstoœæ grafu [ 0.00 ]");
    lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER);
    panel_9.add(lblNewLabel_4);

    sliderDensityGraph = new JSlider();
    sliderDensityGraph.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            int value = sliderDensityGraph.getValue();
            double setValue = value / 100.0;
            lblNewLabel_4.setText("Gêstoœæ grafu [ " + setValue + " ]");
            // textArea.setText( "Slider value = " + setValue );
            CommonVariables.getInstance().GESTOSC_GRAFU = setValue;
          }
        });
    sliderDensityGraph.setToolTipText("Ustaw gêstoœæ grafu z zakresu 0,01 - 1,00");
    sliderDensityGraph.setSnapToTicks(true);
    sliderDensityGraph.setPaintTicks(true);
    sliderDensityGraph.setPaintLabels(true);
    sliderDensityGraph.setMinorTickSpacing(1);
    sliderDensityGraph.setValue(0);
    panel_9.add(sliderDensityGraph);

    JPanel panel_2 = new JPanel();
    panel_1.add(panel_2);
    panel_2.setLayout(new GridLayout(4, 1));

    JPanel panel_4 = new JPanel();
    panel_2.add(panel_4);
    panel_4.setBounds(0, 92, 392, 45);
    panel_4.setLayout(null);

    JLabel label = new JLabel("Zakres wierzcho³ków w serii");
    label.setBounds(202, 14, 187, 14);
    panel_4.add(label);

    spinnerVertexFrom = new JSpinner();
    spinnerVertexFrom.setModel(new SpinnerNumberModel(3, 3, 16, 1));
    spinnerVertexFrom.setBounds(36, 11, 39, 20);
    panel_4.add(spinnerVertexFrom);

    spinnerVertextTo = new JSpinner();
    spinnerVertextTo.setModel(new SpinnerNumberModel(3, 3, 16, 1));
    spinnerVertextTo.setBounds(119, 11, 39, 20);
    panel_4.add(spinnerVertextTo);

    JLabel lblOd = new JLabel("od");
    lblOd.setBounds(10, 14, 16, 14);
    panel_4.add(lblOd);

    JLabel lblDo = new JLabel("do");
    lblDo.setBounds(93, 14, 16, 14);
    panel_4.add(lblDo);

    JPanel panel_6 = new JPanel();
    panel_6.setBounds(0, 47, 392, 45);
    panel_2.add(panel_6);
    panel_6.setLayout(null);

    tfNumberOfMeasurements = new JTextField();
    tfNumberOfMeasurements.setBounds(10, 11, 48, 20);
    panel_6.add(tfNumberOfMeasurements);
    tfNumberOfMeasurements.setColumns(10);

    tfNumberOfMeasurements.setText(
        CommonVariables.getInstance().LICZBA_SERII_POMIAROW_DLA_JEDNEGO_ZADANIA + "");

    JLabel lblNewLabel_3 = new JLabel("Iloœæ pomiarów dla zadania");
    lblNewLabel_3.setBounds(204, 14, 185, 14);
    panel_6.add(lblNewLabel_3);

    JPanel panel_11 = new JPanel();
    panel_2.add(panel_11);

    JLabel lblRozpocznijSymulacj = new JLabel("Rozpocznij symulacjê");
    lblRozpocznijSymulacj.setFont(new Font("Tahoma", Font.BOLD, 11));
    panel_11.add(lblRozpocznijSymulacj);

    JPanel panel_12 = new JPanel();
    panel_2.add(panel_12);

    JButton btnStart = new JButton("Start");

    btnStart.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            // textArea.setText( "Wciœniêto Start i rozpoczêto symulacjê\n"
            // );
            // textArea.append( "Liczba generowanych grafów = " +
            // tfNumberOfGraphs.getText() + "\n" );
            // textArea.append( "Iloœæ pomiarów dla zadania = " +
            // tfNumberOfMeasurements.getText() + "\n" );
            // textArea.append( "Od = " + spinnerVertexFrom.getValue() +
            // "\n" );
            // textArea.append( "Do = " + spinnerVertextTo.getValue() + "\n"
            // );

            if (
            /* !tfNumberOfGraphs.getText().toString().trim().isEmpty() && */ !tfNumberOfGraphs
                .getText()
                .equals(new String(""))) {
              CommonVariables.getInstance().LICZBA_GENEROWANYCH_GRAFOW_W_SERII =
                  Integer.valueOf(tfNumberOfGraphs.getText());
            } else {
              System.out.println("Podaj liczbê w iloœci generowanych grafów!");
            }
            if (
            /*!tfNumberOfMeasurements.getText().trim().isEmpty() && */ !tfNumberOfMeasurements
                .getText()
                .equals(new String(""))) {
              CommonVariables.getInstance().LICZBA_SERII_POMIAROW_DLA_JEDNEGO_ZADANIA =
                  Integer.valueOf(tfNumberOfMeasurements.getText());
            } else {
              System.out.println("Podaj liczbê w iloœæ pomiarów dla zadania!");
            }
            // CommonVariables.getInstance().LICZBA_SERII_POMIAROW_DLA_JEDNEGO_ZADANIA
            // = Integer.valueOf( tfNumberOfMeasurements.getText().trim() );
            CommonVariables.getInstance().SERIA_POMIAROW_OD = (int) spinnerVertexFrom.getValue();
            CommonVariables.getInstance().SERIA_POMIAROW_DO = (int) spinnerVertextTo.getValue();

            setDisableComponents();

            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    // JOptionPane.showMessageDialog(frame, "Proszê czekaæ...");
                    runAlgorithms();
                  }
                });

            // runAlgorithms();
            setEnableComponents();
          }
        });
    btnStart.setForeground(new Color(0, 0, 0));
    panel_12.add(btnStart);
  }
예제 #12
0
파일: TopPanel.java 프로젝트: eunsebi/java
  public TopPanel() {

    setLayout(null);

    menu_panel.setBounds(0, 0, 980, 30);
    add(menu_panel);
    menu_panel.setLayout(null);

    btn_a001 = new JButton("디바이스 선택");
    btn_a001.setBounds(14, 5, 120, 23);
    menu_panel.add(btn_a001);

    btn_a002 = new JButton("게임 설정");
    btn_a002.setBounds(136, 5, 120, 23);
    buttonHandler buttonHandler = new buttonHandler();
    btn_a002.addActionListener(buttonHandler);
    menu_panel.add(btn_a002);

    btn_a003 = new JButton("로그");
    btn_a003.setBounds(261, 5, 57, 23);
    menu_panel.add(btn_a003);

    btn_a004 = new JButton("기타");
    btn_a004.setBounds(320, 5, 57, 23);
    menu_panel.add(btn_a004);

    btn_a005 = new JButton("시작");
    btn_a005.setBounds(384, 5, 57, 23);
    menu_panel.add(btn_a005);

    btn_a006 = new JButton("정지");
    btn_a006.setBounds(441, 5, 57, 23);
    menu_panel.add(btn_a006);

    btn_a007 = new JButton("게임 설정 저장");
    btn_a007.setBounds(500, 5, 113, 23);
    menu_panel.add(btn_a007);

    btn_a008 = new JButton("게임 설정 로드");
    btn_a008.setBounds(615, 5, 113, 23);
    menu_panel.add(btn_a008);

    btn_a009 = new JButton("게임 크기 복원");
    btn_a009.setBounds(730, 5, 113, 23);
    menu_panel.add(btn_a009);

    lbl_a001 = new JLabel("숨기기");
    lbl_a001.setBounds(850, 9, 36, 15);
    menu_panel.add(lbl_a001);

    spinner = new JSpinner();
    spinner.setBounds(893, 5, 29, 22);
    menu_panel.add(spinner);

    btn_a010 = new JButton("");
    btn_a010.setBounds(924, 4, 25, 12);
    menu_panel.add(btn_a010);

    btn_a011 = new JButton("");
    btn_a011.setBounds(950, 4, 25, 12);
    menu_panel.add(btn_a011);

    btn_a012 = new JButton("");
    btn_a012.setBounds(924, 17, 25, 12);
    menu_panel.add(btn_a012);

    btn_a013 = new JButton("");
    btn_a013.setBounds(950, 17, 25, 12);
    menu_panel.add(btn_a013);
  }
예제 #13
0
  InputFrame() {
    JPanel pane = new JPanel();
    pane.setLayout(null);
    pane.setBackground(Color.LIGHT_GRAY);
    add(pane);
    // JTextField文字欄位元件
    lblName = new JLabel("姓名:");
    lblName.setBounds(10, 10, 40, 20);
    pane.add(lblName);
    text0.setBounds(50, 10, 80, 20);
    text0.addActionListener(textfield);
    pane.add(text0);
    // JSpinner數位序列元件
    lblAge = new JLabel("年齡:");
    lblAge.setBounds(170, 10, 40, 20);
    pane.add(lblAge);
    JSpinner spin = new JSpinner(new SpinnerNumberModel(20, 1, 100, 1));
    spin.setBounds(210, 10, 80, 20);
    spin.addChangeListener(spinner);
    pane.add(spin);
    // JRadioButton選項圓鈕元件
    lblSex = new JLabel("性別:");
    lblSex.setBounds(10, 40, 40, 20);
    pane.add(lblSex);
    ButtonGroup group = new ButtonGroup();
    JRadioButton rb1 = new JRadioButton("帥哥", false);
    rb1.setBounds(50, 40, 60, 20);
    JRadioButton rb2 = new JRadioButton("美女", false);
    rb2.setBounds(110, 40, 60, 20);
    rb1.setOpaque(false);
    rb2.setOpaque(false); // 秀出底色
    rb1.addActionListener(radio);
    rb2.addActionListener(radio);
    group.add(rb1);
    group.add(rb2);
    pane.add(rb1);
    pane.add(rb2);
    // JCheckBox核對方塊元件
    lblInter = new JLabel("興趣:");
    lblInter.setBounds(10, 70, 50, 20);
    pane.add(lblInter);
    for (int i = 0; i < check.length; i++) {
      check[i] = new JCheckBox(checkItem[i]);
      check[i].setBounds(50 + 60 * i, 70, 60, 20);
      check[i].setOpaque(false);
      check[i].addActionListener(checkbox);
      pane.add(check[i]);
    }
    // JComboBox下拉式清單元件
    lblAcad = new JLabel("學歷:");
    lblAcad.setBounds(10, 100, 50, 20);
    pane.add(lblAcad);
    String[] items_c = {"博士", "碩士", "大學", "高中", "國中", "國小"};
    JComboBox c_box = new JComboBox(items_c);
    c_box.setBounds(50, 100, 100, 20);
    c_box.addItemListener(cbo);
    pane.add(c_box);
    // JList清單元件
    lblPlace = new JLabel("居住地區:");
    lblPlace.setBounds(170, 100, 70, 20);
    pane.add(lblPlace);
    String[] items_p = {
      "台北", "桃園", "新竹", "苗栗", "台中", "彰化", "雲林", "嘉義", "台南", "高雄", "屏東", "花蓮", "台東", "澎湖"
    };
    JList list = new JList(items_p);
    list.setVisibleRowCount(4);
    list.addListSelectionListener(list_p);
    JScrollPane scroll = new JScrollPane(list);
    scroll.setBounds(240, 100, 80, 80);
    pane.add(scroll);
    // JTextArea文字區域元件
    texta.setBounds(10, 190, 330, 40);
    texta.setEditable(false);
    pane.add(texta);

    setTitle("輸入元件綜合應用");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(50, 50, 360, 280);
    setVisible(true);
  }
  protected void initComponents() {
    super.setLayout(null);
    super.setResizable(false);

    txtPassword =
        new JTextField() {
          public void paint(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            super.paint(g);
          }
        };
    txtPassword.setBackground(Color.BLACK);
    txtPassword.setForeground(Color.GREEN);
    txtPassword.setSelectionColor(Color.GREEN);
    txtPassword.setSelectedTextColor(Color.BLACK);
    txtPassword.setBounds(5, 5, 450, 30);
    txtPassword.setEditable(false);
    txtPassword.setFont(new Font("Courier New", Font.BOLD, 18));
    txtPassword.setHorizontalAlignment(JTextField.CENTER);
    txtPassword.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {

            if (generating) {
              e.consume();
              return;
            }

            txtPassword.selectAll();
            Clipboard clipboard = toolkit.getSystemClipboard();
            StringSelection selection = new StringSelection(txtPassword.getText());
            clipboard.setContents(selection, null);

            JOptionPane optionPane =
                new JOptionPane("クリップボードにコピーしました。", JOptionPane.INFORMATION_MESSAGE);
            final JDialog dialog = optionPane.createDialog(PasswordGeneratorGUI.this, "通知");
            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    (new Timer())
                        .schedule(
                            new TimerTask() {
                              @Override
                              public void run() {
                                dialog.setVisible(false);
                              }
                            },
                            1000);

                    dialog.setVisible(true);
                  }
                });
          }
        });
    super.add(txtPassword);

    cbxNumber = new JCheckBox("数字");
    cbxNumber.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            validCheckBox();
          }
        });
    cbxNumber.setBounds(5, 40, 60, 25);
    cbxNumber.setSelected(true);
    cbxNumber.setToolTipText(PasswordGenerator.NUMBER.toString());
    super.add(cbxNumber);

    cbxAlphabet = new JCheckBox("英字");
    cbxAlphabet.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            validCheckBox();
          }
        });
    cbxAlphabet.setBounds(70, 40, 60, 25);
    cbxAlphabet.setSelected(true);
    cbxAlphabet.setToolTipText(PasswordGenerator.ALPHABET_S.toString());
    super.add(cbxAlphabet);

    cbxSymbol = new JCheckBox("記号");
    cbxSymbol.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            validCheckBox();
          }
        });
    cbxSymbol.setBounds(135, 40, 60, 25);
    cbxSymbol.setSelected(true);
    cbxSymbol.setToolTipText(SYMBOL.toString());
    super.add(cbxSymbol);

    spinnerModel = new SpinnerNumberModel(8, 1, 32, 1);
    spnLength = new JSpinner(spinnerModel);
    spnLength.setBounds(210, 40, 50, 25);
    super.add(spnLength);

    btnGenerate = new JButton("生成");
    btnGenerate.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            generate();
          }
        });
    btnGenerate.setBounds(275, 40, 174, 24);
    super.add(btnGenerate);
  }
예제 #15
0
  /** Create the panel. */
  public GuiPeakCalling() {
    setLayout(null);

    macs14RadioButton = new JRadioButton("macs14");
    macs14RadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (macs14RadioButton.isSelected()) {
              macs14Panel.setVisible(true);
              Sicerpanel.setVisible(false);
            }
          }
        });
    macs14RadioButton.setFont(new Font("Dialog", Font.BOLD, 15));
    macs14RadioButton.setHorizontalAlignment(SwingConstants.CENTER);
    macs14RadioButton.setBounds(19, 116, 122, 31);
    add(macs14RadioButton);
    buttonGroup.add(macs14RadioButton);

    sicerRadioButton = new JRadioButton("Sicer");
    sicerRadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (sicerRadioButton.isSelected()) {
              Sicerpanel.setVisible(true);
              macs14Panel.setVisible(false);
            }
          }
        });
    sicerRadioButton.setFont(new Font("Dialog", Font.BOLD, 15));
    sicerRadioButton.setBounds(27, 261, 103, 23);
    add(sicerRadioButton);
    buttonGroup.add(sicerRadioButton);

    guiLayeredPanSpeciesVersion = new GuiLayeredPanSpeciesVersion();
    guiLayeredPanSpeciesVersion.setBounds(27, 12, 237, 96);
    add(guiLayeredPanSpeciesVersion);
    JButton saveButton = new JButton("SAVE");
    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String outPath = guiFileOpen.saveFileNameAndPath("", "");
            txtSavePath.setText(outPath);
          }
        });
    saveButton.setBounds(276, 25, 118, 25);
    add(saveButton);

    txtSavePath = new JTextField();
    txtSavePath.setBounds(429, 25, 292, 25);
    add(txtSavePath);
    txtSavePath.setColumns(10);

    macs14Panel = new JPanel();
    macs14Panel.setLayout(null);
    macs14Panel.setBounds(37, 157, 684, 96);
    add(macs14Panel);

    txtControlFileMacs = new JTextField();
    txtControlFileMacs.setColumns(10);
    txtControlFileMacs.setBounds(149, 49, 114, 25);
    macs14Panel.add(txtControlFileMacs);

    txtInFileMacs = new JTextField();
    txtInFileMacs.setColumns(10);
    txtInFileMacs.setBounds(149, 12, 114, 25);
    macs14Panel.add(txtInFileMacs);

    JButton controlFilebutton = new JButton("ControlFile");
    controlFilebutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtControlFileMacs.setText(guiFileOpen.openFileName("", ""));
          }
        });
    controlFilebutton.setBounds(12, 49, 93, 25);
    macs14Panel.add(controlFilebutton);

    JButton inFilebutton = new JButton("InFile");
    inFilebutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtInFileMacs.setText(guiFileOpen.openFileName("", ""));
          }
        });
    inFilebutton.setBounds(12, 12, 93, 25);
    macs14Panel.add(inFilebutton);

    mfoldminspinner = new JSpinner();
    mfoldminspinner.setModel(new SpinnerNumberModel(new Integer(2), null, null, new Integer(1)));
    mfoldminspinner.setBounds(403, 13, 69, 23);
    macs14Panel.add(mfoldminspinner);

    mfoldMaxspinner = new JSpinner();
    mfoldMaxspinner.setModel(new SpinnerNumberModel(new Integer(300), null, null, new Integer(1)));
    mfoldMaxspinner.setBounds(584, 13, 69, 23);
    macs14Panel.add(mfoldMaxspinner);

    JLabel pvalueLabel = new JLabel("pvalue");
    pvalueLabel.setBounds(304, 49, 69, 25);
    macs14Panel.add(pvalueLabel);

    JLabel mfoldMaxLabel = new JLabel("mfoldMax");
    mfoldMaxLabel.setBounds(495, 12, 81, 25);
    macs14Panel.add(mfoldMaxLabel);

    JLabel mfoldminLabel = new JLabel("mfoldMin");
    mfoldminLabel.setBounds(304, 12, 81, 25);
    macs14Panel.add(mfoldminLabel);

    JButton mac14startbutton = new JButton("macs14Start");
    mac14startbutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            runMacs();
          }
        });
    mac14startbutton.setBounds(521, 42, 132, 38);
    macs14Panel.add(mac14startbutton);

    txtPvalue = new JTextField();
    txtPvalue.setText("0.01");
    txtPvalue.setColumns(10);
    txtPvalue.setBounds(403, 49, 69, 25);
    macs14Panel.add(txtPvalue);

    Sicerpanel = new JPanel();
    Sicerpanel.setBounds(37, 294, 691, 296);
    Sicerpanel.setVisible(false);
    add(Sicerpanel);
    Sicerpanel.setLayout(null);

    cmbSICERtype = new JComboBoxData<PeakCallingSicerType>();
    cmbSICERtype.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            setComponentVisibleSICER(cmbSICERtype.getSelectedValue());
          }
        });
    cmbSICERtype.setBounds(18, 10, 323, 32);
    Sicerpanel.add(cmbSICERtype);
    cmbSICERtype.setMapItem(PeakCallingSicerType.getMapType());

    sicer_df_rbPanel = new JPanel();
    sicer_df_rbPanel.setBounds(18, 80, 517, 81);
    Sicerpanel.add(sicer_df_rbPanel);
    sicer_df_rbPanel.setLayout(null);

    kobedFilebutton = new JButton("koBedFile");
    kobedFilebutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String koBedPathAndFile = guiFileOpen.openFileName("", "");
            txtKobedFileSICER.setText(koBedPathAndFile);
            txtKoPrefixSICER.setText(FileOperate.getFileName(koBedPathAndFile).split("_")[0]);
          }
        });
    kobedFilebutton.setBounds(16, 12, 106, 25);
    sicer_df_rbPanel.add(kobedFilebutton);

    txtKobedFileSICER = new JTextField();
    txtKobedFileSICER.setColumns(10);
    txtKobedFileSICER.setBounds(134, 11, 177, 27);
    sicer_df_rbPanel.add(txtKobedFileSICER);

    KoColFilebutton = new JButton("koColFile");
    KoColFilebutton.setBounds(16, 49, 106, 25);
    sicer_df_rbPanel.add(KoColFilebutton);
    KoColFilebutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String koColPathAndFile = guiFileOpen.openFileName("", "");
            txtKoColFileSICER.setText(koColPathAndFile);
          }
        });
    KoColFilebutton.setEnabled(false);

    txtKoColFileSICER = new JTextField();
    txtKoColFileSICER.setBounds(134, 50, 175, 25);
    sicer_df_rbPanel.add(txtKoColFileSICER);
    txtKoColFileSICER.setColumns(10);
    txtKoColFileSICER.setEnabled(false);

    sicer_dfPanel = new JPanel();
    sicer_dfPanel.setLayout(null);
    sicer_dfPanel.setBounds(18, 173, 517, 81);
    Sicerpanel.add(sicer_dfPanel);

    wtBedFilebutton = new JButton("wtBedFile");
    wtBedFilebutton.setBounds(12, 12, 106, 25);
    sicer_dfPanel.add(wtBedFilebutton);
    wtBedFilebutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String wtBedPathAndFile = guiFileOpen.openFileName("", "");
            txtWtBedFileSICER.setText(wtBedPathAndFile);
            txtWtPrefixSICER.setText(FileOperate.getFileName(wtBedPathAndFile).split("_")[0]);
          }
        });
    wtBedFilebutton.setEnabled(false);

    txtWtBedFileSICER = new JTextField();
    txtWtBedFileSICER.setBounds(136, 12, 175, 25);
    sicer_dfPanel.add(txtWtBedFileSICER);
    txtWtBedFileSICER.setColumns(10);
    txtWtBedFileSICER.setEditable(false);

    wtcolFilebutton = new JButton("wtColFile");
    wtcolFilebutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String wtColPathAndFile = guiFileOpen.openFileName("", "");
            txtWtcolFileSICER.setText(wtColPathAndFile);
          }
        });
    wtcolFilebutton.setBounds(12, 49, 106, 25);
    sicer_dfPanel.add(wtcolFilebutton);

    txtWtcolFileSICER = new JTextField();
    txtWtcolFileSICER.setColumns(10);
    txtWtcolFileSICER.setBounds(136, 49, 175, 25);
    sicer_dfPanel.add(txtWtcolFileSICER);

    JButton sicerStartbutton = new JButton("sicerSTART");
    sicerStartbutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            runSicer();
          }
        });
    sicerStartbutton.setBounds(547, 80, 129, 174);
    Sicerpanel.add(sicerStartbutton);

    cmbMethyTypeSicer = new JComboBoxData<Integer>();
    cmbMethyTypeSicer.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            methylationType = cmbMethyTypeSicer.getSelectedValue();
            if (methylationType == 40) {
              dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
              dialog.setVisible(true);
              System.out.println(dialog.getWindowSize());
              System.out.println(dialog.getGapSize());
            }
          }
        });

    cmbMethyTypeSicer.setMapItem(SicerControl.getMapMethyStr2Int());
    cmbMethyTypeSicer.setBounds(18, 54, 323, 24);
    Sicerpanel.add(cmbMethyTypeSicer);
    kobedFilebutton.setEnabled(true);
    txtKobedFileSICER.setEnabled(true);

    txtKoPrefixSICER = new JTextField();
    txtKoPrefixSICER.setBounds(382, 15, 123, 19);
    sicer_df_rbPanel.add(txtKoPrefixSICER);
    txtKoPrefixSICER.setColumns(10);

    JLabel koPrelabel = new JLabel("koPrefix");
    koPrelabel.setBounds(315, 17, 68, 15);
    sicer_df_rbPanel.add(koPrelabel);
    wtcolFilebutton.setEnabled(false);
    txtWtcolFileSICER.setEnabled(false);

    txtWtPrefixSICER = new JTextField();
    txtWtPrefixSICER.setBounds(386, 15, 119, 19);
    sicer_dfPanel.add(txtWtPrefixSICER);
    txtWtPrefixSICER.setColumns(10);
    txtWtPrefixSICER.setEditable(false);

    wtPrefix = new JLabel("wtPrefix");
    wtPrefix.setBounds(317, 17, 68, 15);
    sicer_dfPanel.add(wtPrefix);
    wtPrefix.setEnabled(false);
  }