Ejemplo n.º 1
0
 /**
  * Create the physical control.
  *
  * @param bEditableControl Is this control editable?
  * @return The new control.
  */
 public Component setupControl(boolean bEditableControl) {
   String strDesc = ((SRadioButton) this.getScreenField()).getButtonDesc();
   JRadioButton control = null;
   String m_strImageButton = ((SRadioButton) this.getScreenField()).getImageButtonName();
   if (m_strImageButton == null) control = new JRadioButton(strDesc); // Physical control
   else if ((strDesc == null) || (strDesc.length() == 0))
     control =
         new JRadioButton(
             this.loadImageIcon(
                 m_strImageButton, null)); // Get this image, then redisplay me when you're done
   else
     control =
         new JRadioButton(
             strDesc,
             this.loadImageIcon(
                 m_strImageButton, null)); // Get this image, then redisplay me when you're done
   control.setOpaque(false);
   control.setHorizontalTextPosition(JToggleButton.LEFT);
   control.setIconTextGap(
       org.jbundle.base.screen.control.javafx.util.ScreenInfo.EXTRA_COL_SPACING);
   if (bEditableControl) {
     control.addFocusListener(this);
     control.addActionListener(this);
   }
   return control;
 }
Ejemplo n.º 2
0
 private void addRadioButton(String content) {
   JRadioButton b = new JRadioButton(content);
   b.setOpaque(true);
   b.addActionListener(this.listener);
   b.setDoubleBuffered(true);
   this.group.add(b);
   this.radioButtonPanel.add(b);
   if (this.isFirst) {
     b.setSelected(true);
     this.isFirst = false;
   }
 }
Ejemplo n.º 3
0
 private static void createAndShowGUI() {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setBackground(Color.BLUE);
   radioButton = new JRadioButton();
   radioButton.setOpaque(false);
   JPanel panel = new JPanel();
   panel.setBackground(Color.BLUE);
   panel.add(radioButton);
   frame.getContentPane().add(panel);
   frame.pack();
   frame.setVisible(true);
 }
Ejemplo n.º 4
0
  /** Main method of the class. It initializes the {@link ProjectTypePanel} panel. */
  private void init() {
    // Radio buttons
    newRadio = new JRadioButton("New project");
    newRadio.setSelected(true);
    loadRadio = new JRadioButton("Load an existing project");

    setOpaque(false);
    newRadio.setOpaque(false);
    loadRadio.setOpaque(false);

    // Listener
    newRadio.addActionListener(this);
    loadRadio.addActionListener(this);

    // Radio group
    projectRadio = new ButtonGroup();
    projectRadio.add(newRadio);
    projectRadio.add(loadRadio);

    // Layout
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    Insets gbcInsets = new Insets(10, 0, 10, 10);

    // newRadio
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = gbcInsets;
    gbc.anchor = GridBagConstraints.CENTER;
    add(newRadio, gbc);

    // loadRadio
    gbc.gridx = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbcInsets = new Insets(10, 50, 10, 0);
    gbc.insets = gbcInsets;
    add(loadRadio, gbc);
  }
Ejemplo n.º 5
0
  public BreakpointHitEditor(
      final Debugger debugger,
      final DebuggerPane debuggerPane,
      final BreakpointHitNode breakpointHitNode) {
    super(new BorderLayout());
    setOpaque(false);
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.setOpaque(false);
    JPanel breakpointHitExecutionPane = new JPanel(new GridBagLayout());
    breakpointHitExecutionPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 5, 5));
    breakpointHitExecutionPane.setOpaque(false);
    hit = breakpointHitNode.getUserObject();
    int y = 0;
    breakpointHitExecutionPane.add(
        new JLabel("Query:"),
        new GridBagConstraints(
            0,
            y++,
            1,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    SqlTextArea sqlTextArea = new SqlTextArea();
    String sql = hit.getSQL();
    String parameterDescription = hit.getParameterDescription();
    if (parameterDescription != null) {
      sql += "\n -> " + parameterDescription;
    }
    sqlTextArea.setText(sql + "\n");
    sqlTextArea.setCaretPosition(0);
    breakpointHitExecutionPane.add(
        new RTextScrollPane(sqlTextArea),
        new GridBagConstraints(
            0,
            y++,
            1,
            1,
            1,
            1,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    if (hit.isBeforeExecution()) {
      replaceCheckbox = new JCheckBox("Replace with statement");
      replaceCheckbox.setOpaque(false);
      replaceCheckbox.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              adjustStates();
            }
          });
      breakpointHitExecutionPane.add(
          replaceCheckbox,
          new GridBagConstraints(
              0,
              y++,
              1,
              1,
              0,
              0,
              GridBagConstraints.WEST,
              GridBagConstraints.NONE,
              new Insets(5, 0, 0, 0),
              0,
              0));
      replaceTextArea = new SqlTextArea();
      replacePane = new RTextScrollPane(replaceTextArea);
      breakpointHitExecutionPane.add(
          replacePane,
          new GridBagConstraints(
              0,
              y++,
              1,
              1,
              1,
              1,
              GridBagConstraints.WEST,
              GridBagConstraints.BOTH,
              new Insets(2, 20, 0, 0),
              0,
              0));
    }
    JPanel executionTypePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    // For now, this choice is not exposed.
    executionTypePane.setVisible(hit.isBeforeExecution());
    executionTypePane.setOpaque(false);
    ButtonGroup executionTypeGroup = new ButtonGroup();

    final JRadioButton executeTypeNoneRadioButton = new JRadioButton("Execute");
    executeTypeNoneRadioButton.setOpaque(false);
    executeTypeNoneRadioButton.setSelected(true);
    executionTypeGroup.add(executeTypeNoneRadioButton);
    executionTypePane.add(executeTypeNoneRadioButton);

    final JRadioButton executeTypeBreakRadioButton = new JRadioButton("Execute and break");
    executeTypeBreakRadioButton.setOpaque(false);
    executionTypeGroup.add(executeTypeBreakRadioButton);
    executionTypePane.add(executeTypeBreakRadioButton);

    final JRadioButton executeTypeSkipRadioButton = new JRadioButton("Skip");
    executeTypeSkipRadioButton.setOpaque(false);
    executionTypeGroup.add(executeTypeSkipRadioButton);
    executionTypePane.add(executeTypeSkipRadioButton);

    final JRadioButton executeTypeFailRadioButton = new JRadioButton("Throw exception");
    executeTypeFailRadioButton.setOpaque(false);
    executionTypeGroup.add(executeTypeFailRadioButton);
    executionTypePane.add(executeTypeFailRadioButton);

    breakpointHitExecutionPane.add(
        executionTypePane,
        new GridBagConstraints(
            0,
            y++,
            1,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 0, 0, 0),
            0,
            0));
    JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
    buttonPane.setOpaque(false);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    JButton applyButton = new JButton("Proceed");
    applyButton.setOpaque(false);
    applyButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (hit.isBeforeExecution()) {
              String replacementSQL = null;
              ExecutionType type = RUN;
              if (executeTypeNoneRadioButton.isSelected()) {
                type = RUN;
                replacementSQL = replaceCheckbox.isSelected() ? replaceTextArea.getText() : null;
              } else if (executeTypeBreakRadioButton.isSelected()) {
                type = STEP;
                replacementSQL = replaceCheckbox.isSelected() ? replaceTextArea.getText() : null;
              } else if (executeTypeSkipRadioButton.isSelected()) {
                type = SKIP;
              } else if (executeTypeFailRadioButton.isSelected()) {
                type = FAIL;
              }

              hit.setExecutionType(type, replacementSQL);
            } else {
              hit.setExecutionType(RUN, null);
            }
            debuggerPane.proceedBreakpointHit(breakpointHitNode);
          }
        });
    buttonPane.add(applyButton);
    breakpointHitExecutionPane.add(
        buttonPane,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    adjustStates();
    tabbedPane.addTab("Execution", breakpointHitExecutionPane);
    tabbedPane.addTab(
        "Editor",
        new EditorsPane(
            new QueryExecutorCreator() {
              @Override
              public QueryExecutor createQueryExecutor() {
                return debugger.createBreakpointHitStatementExecutor(hit.getThreadID());
              }
            },
            false));
    add(tabbedPane);
  }
Ejemplo n.º 6
0
  @Override
  public void installUI(final JComponent c) {
    super.installUI(c);

    radioButton = (JRadioButton) c;

    // Default settings
    SwingUtils.setOrientation(c);
    radioButton.setOpaque(false);

    // Initial check state
    checkIcon = radioButton.isSelected() ? CHECK_STATES.size() - 1 : 0;

    // Updating border and icon
    updateBorder();
    updateIcon(radioButton);

    // Background fade animation
    bgTimer =
        new WebTimer(
            "WebRadioButtonUI.bgUpdater",
            40,
            new ActionListener() {
              @Override
              public void actionPerformed(final ActionEvent e) {
                if (rollover && bgDarkness < MAX_DARKNESS) {
                  bgDarkness++;
                  c.repaint();
                } else if (!rollover && bgDarkness > 0) {
                  bgDarkness--;
                  c.repaint();
                } else {
                  bgTimer.stop();
                }
              }
            });
    mouseAdapter =
        new MouseAdapter() {
          @Override
          public void mouseEntered(final MouseEvent e) {
            rollover = true;
            if (isAnimated()) {
              bgTimer.start();
            } else {
              bgDarkness = MAX_DARKNESS;
              c.repaint();
            }
          }

          @Override
          public void mouseExited(final MouseEvent e) {
            rollover = false;
            if (isAnimated()) {
              bgTimer.start();
            } else {
              bgDarkness = 0;
              c.repaint();
            }
          }
        };
    radioButton.addMouseListener(mouseAdapter);

    // Selection changes animation
    checkTimer =
        new WebTimer(
            "WebRadioButtonUI.iconUpdater",
            40,
            new ActionListener() {
              @Override
              public void actionPerformed(final ActionEvent e) {
                if (checking && checkIcon < CHECK_STATES.size() - 1) {
                  checkIcon++;
                  c.repaint();
                } else if (!checking && checkIcon > 0) {
                  checkIcon--;
                  c.repaint();
                } else {
                  checkTimer.stop();
                }
              }
            });
    itemListener =
        new ItemListener() {
          @Override
          public void itemStateChanged(final ItemEvent e) {
            if (animated) {
              if (radioButton.isSelected()) {
                checking = true;
                checkTimer.start();
              } else {
                checking = false;
                checkTimer.start();
              }
            } else {
              checkTimer.stop();
              checkIcon = radioButton.isSelected() ? CHECK_STATES.size() - 1 : 0;
              c.repaint();
            }
          }
        };
    radioButton.addItemListener(itemListener);
  }
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    final javax.swing.ButtonGroup acceptOrDeclineButtonGroup = new javax.swing.ButtonGroup();
    final javax.swing.JLabel explanationJLabel = new javax.swing.JLabel();

    setOpaque(false);
    explanationJLabel.setFont(Fonts.DialogFont);
    explanationJLabel.setText(
        java.util.ResourceBundle.getBundle("localization/Browser_Messages")
            .getString("UpgradeAccountAvatar.Agreement.Explanation"));

    licenseAgreementJTextArea.setColumns(20);
    licenseAgreementJTextArea.setEditable(false);
    licenseAgreementJTextArea.setFont(Fonts.DialogTextEntryFont);
    licenseAgreementJTextArea.setRows(5);
    licenseAgreementJTextArea.setTabSize(4);
    licenseAgreementJTextArea.setFocusable(false);
    licenseAgreementJScrollPane.setViewportView(licenseAgreementJTextArea);

    acceptOrDeclineButtonGroup.add(acceptJRadioButton);
    acceptJRadioButton.setFont(Fonts.DialogFont);
    acceptJRadioButton.setText(
        java.util.ResourceBundle.getBundle("localization/Browser_Messages")
            .getString("UpgradeAccountAvatar.Agreement.AcceptLicenseAgreement"));
    acceptJRadioButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    acceptJRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
    acceptJRadioButton.setOpaque(false);
    acceptJRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            acceptJRadioButtonActionPerformed(evt);
          }
        });

    acceptOrDeclineButtonGroup.add(declineJRadioButton);
    declineJRadioButton.setFont(Fonts.DialogFont);
    declineJRadioButton.setText(
        java.util.ResourceBundle.getBundle("localization/Browser_Messages")
            .getString("UpgradeAccountAvatar.Agreement.DeclineLicenseAgreement"));
    declineJRadioButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    declineJRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
    declineJRadioButton.setOpaque(false);
    declineJRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            declineJRadioButtonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                licenseAgreementJScrollPane,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                455,
                                Short.MAX_VALUE)
                            .addComponent(explanationJLabel)
                            .addComponent(acceptJRadioButton)
                            .addComponent(declineJRadioButton))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(100, 100, 100)
                    .addComponent(explanationJLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        licenseAgreementJScrollPane,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        214,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(19, 19, 19)
                    .addComponent(acceptJRadioButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(declineJRadioButton)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
  } // </editor-fold>//GEN-END:initComponents
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();

    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

    // 将背景修改为指定图片
    background = new ImageIcon("loginPicture.jpg");
    JLabel label = new JLabel(background);
    label.setBounds(0, 0, background.getIconWidth(), background.getIconHeight());
    imagePanel = (JPanel) frame.getContentPane();
    imagePanel.setOpaque(false);
    // imagePanel.setLayout(new );
    frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE));

    frame.setSize(1024, 596);
    frame.setResizable(false);

    ButtonGroup positionButtonGroup = new ButtonGroup();
    frame.getContentPane().setLayout(null);

    label_2 = new JLabel("\u7528\u6237\u540D\uFF1A");
    label_2.setBounds(253, 57, 54, 15);
    frame.getContentPane().add(label_2);

    textField = new JTextField();
    textField.setBounds(253, 112, 352, 23);

    frame.getContentPane().add(textField);
    textField.setColumns(10);
    stringTextField = textField.getText();

    label_1 = new JLabel("\u5BC6  \u7801\uFF1A");
    label_1.setBounds(253, 325, 54, 15);
    frame.getContentPane().add(label_1);

    passwordField = new JPasswordField();
    passwordField.setBounds(253, 383, 352, 23);

    frame.getContentPane().add(passwordField);
    stringPasswordField = new String(passwordField.getPassword());

    JPanel panel = new JPanel();
    panel.setBounds(40, 225, 161, 219);
    frame.getContentPane().add(panel);
    panel.setLayout(null);

    JRadioButton radioButton = new JRadioButton("\u7BA1\u7406\u5458");
    radioButton.setBounds(5, 33, 94, 23);
    radioButton.setOpaque(false);
    radioButton.addActionListener(this);

    JRadioButton radioButton_1 = new JRadioButton("\u5DE5\u4F5C\u4EBA\u5458");
    radioButton_1.setBounds(5, 99, 93, 23);
    radioButton_1.setOpaque(false);
    radioButton_1.addActionListener(this);

    JRadioButton radioButton_2 = new JRadioButton("\u5B66\u751F");
    radioButton_2.setBounds(5, 165, 94, 23);
    radioButton_2.setOpaque(false);
    radioButton_2.addActionListener(this);

    positionButtonGroup.add(radioButton);
    positionButtonGroup.add(radioButton_1);
    positionButtonGroup.add(radioButton_2);

    panel.setOpaque(false);
    panel.add(radioButton);
    panel.add(radioButton_1);
    panel.add(radioButton_2);

    JButton btnNewButton = new JButton("\u767B\u9646");

    // 与数据库连接用于密码匹配
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            stringTextField = textField.getText();
            stringPasswordField = new String(passwordField.getPassword());

            StudentDatabase sd = new StudentDatabase(stringTextField, stringPasswordField);
            StaffDatabase fd = new StaffDatabase(stringTextField, stringPasswordField);

            // System.out.println(sd.isResultsetIsNotNull());

            if ((positionFlag == 00)
                && (stringTextField.equals("myAdmin"))
                && (stringPasswordField.equals("admin"))) {
              amf = new AdministratorMainInterface();
              frame.dispose();
            } else if ((positionFlag == 10) && fd.isResultsetIsNotNull()) {
              fmf = new StaffMainInterface();
              frame.dispose();
            } else if ((positionFlag == 11) && sd.isResultsetIsNotNull()) {
              smf = new StudentsMainInterface();
              frame.dispose();
            } else {
              JOptionPane.showMessageDialog(
                  null, "用户名不存在或密码输入错误!", "系统信息", JOptionPane.WARNING_MESSAGE);
            }
          }
        });
    btnNewButton.setBounds(731, 274, 195, 51);
    frame.getContentPane().add(btnNewButton);
  }
Ejemplo n.º 9
0
  private void initComponent() {
    // 最基本按钮
    close = new MyButton(30, 30, Img.CLOSE_0, Img.CLOSE_1, Img.CLOSE_2);
    close.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            System.exit(0);
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    min = new MyButton(30, 30, Img.MINI_0, Img.MINI_1, Img.MINI_2);
    min.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            frame.setExtendedState(JFrame.ICONIFIED);
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    _return = new MyButton(30, 30, Img.RETURN_0, Img.RETURN_1, Img.RETURN_2);
    _return.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            frame.dispose();
            new MainFrame();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    // 功能按钮
    goto_AccountManage =
        new MyButton(frame.getWidth() / 6, 30, Img.GOZHANGHU_0, Img.GOZHANGHU_1, Img.GOZHANGHU_2);
    goto_AccountManage.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(1);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_CostManage =
        new MyButton(
            frame.getWidth() / 6, 30, Img.GOCHENGBEN_2, Img.GOCHENGBEN_2, Img.GOCHENGBEN_2);
    goto_CostManage.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(2);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_SettlementManage =
        new MyButton(frame.getWidth() / 6, 30, Img.GOJIESUAN_0, Img.GOJIESUAN_1, Img.GOJIESUAN_2);
    goto_SettlementManage.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(3);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_Statistic =
        new MyButton(
            frame.getWidth() / 6,
            30,
            Img.GOTONGJIBAOBIAO_0,
            Img.GOTONGJIBAOBIAO_1,
            Img.GOTONGJIBAOBIAO_2);
    goto_Statistic.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(4);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_BaseDataSetting =
        new MyButton(frame.getWidth() / 6, 30, Img.GOQICHU_0, Img.GOQICHU_1, Img.GOQICHU_2);
    goto_BaseDataSetting.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(5);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_SystemLog =
        new MyButton(frame.getWidth() / 6, 30, Img.GOXITONG_0, Img.GOXITONG_1, Img.GOXITONG_2);
    goto_SystemLog.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(6);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    // 详细操作按钮
    confirm = new MyButton(90, 30, Img.CONFIRM_0, Img.CONFIRM_1, Img.CONFIRM_2);
    confirm.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            _create();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });

    // 最基本元素
    JLabel titleLabel = new JLabel("物流信息管理系统");
    titleLabel.setSize((int) (50 * 8 * 1.07f), 50);
    titleLabel.setFont(new Font("宋体", Font.BOLD, 50));
    titleLabel.setForeground(Color.BLACK);
    titleLabel.setLocation(596 - (int) (50 * 8 * 1.07f) / 2, 20);

    String func = "成本管理";
    JLabel funLabel = new JLabel(func);
    funLabel.setSize((int) (40 * func.length() * 1.07f), 40);
    funLabel.setFont(new Font("宋体", Font.BOLD, 40));
    funLabel.setLocation(596 - (int) (40 * func.length() * 1.07f) / 2, 128 + 10);

    JLabel currentuserAgencyNameLabel = new JLabel(currentUser.getAgencyName());
    currentuserAgencyNameLabel.setSize(
        (int) (30 * currentUser.getAgencyName().length() * 1.07f), 30);
    currentuserAgencyNameLabel.setFont(new Font("宋体", Font.BOLD, 30));
    currentuserAgencyNameLabel.setForeground(Color.DARK_GRAY);
    currentuserAgencyNameLabel.setLocation(170, 128 - 30);

    String s = "财务人员";
    JLabel currentuserLabel = new JLabel(s);
    currentuserLabel.setSize((int) (30 * s.length() * 1.07f), 30);
    currentuserLabel.setFont(new Font("宋体", Font.BOLD, 30));
    currentuserLabel.setLocation(
        170 + (int) (30 * currentUser.getAgencyName().length() * 1.07f), 128 - 30);

    JLabel currentusernameLabel = new JLabel(currentUser.getname());
    currentusernameLabel.setSize((int) (30 * currentUser.getname().length() * 1.07f), 30);
    currentusernameLabel.setFont(new Font("宋体", Font.BOLD, 30));
    currentusernameLabel.setForeground(Color.DARK_GRAY);
    currentusernameLabel.setLocation(
        170
            + (int) (30 * currentUser.getAgencyName().length() * 1.07f)
            + (int) (30 * s.length() * 1.07f),
        128 - 30);
    // 最基本按钮
    close.setLocation(FinacialStaffHighFrame.w - 30, 0);
    min.setLocation(FinacialStaffHighFrame.w - 80, 0);
    _return.setLocation(20, 50);
    // 功能按钮
    goto_AccountManage.setLocation(0, 150);
    goto_CostManage.setLocation(0, 200);
    goto_SettlementManage.setLocation(0, 250);
    goto_Statistic.setLocation(0, 300);
    goto_BaseDataSetting.setLocation(0, 350);
    goto_SystemLog.setLocation(0, 400);

    // 其他组件
    id = new JLabel("付款单单号:   " + bl.createMoneyOutListId());
    id.setSize((int) (16 * 20 * 1.07f), 16);
    id.setFont(new Font("宋体", Font.BOLD, 15));
    id.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 30);

    JLabel l1 = new JLabel("付款人:");
    l1.setSize((int) (16 * 4 * 1.07f), 16);
    l1.setFont(new Font("宋体", Font.BOLD, 15));
    l1.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80);
    pay_man = new JTextField();
    pay_man.setSize(150, 20);
    pay_man.setLocation(FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 - 3);

    JLabel l2 = new JLabel("付款日期:");
    l2.setSize((int) (16 * 5 * 1.07f), 16);
    l2.setFont(new Font("宋体", Font.BOLD, 15));
    l2.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 50);
    Date date_ = new Date();
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String time = format.format(date_);
    pay_date = new JTextField(time);
    pay_date.setSize(150, 20);
    pay_date.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 50 - 3);

    JLabel l3 = new JLabel("付款金额:");
    l3.setSize((int) (16 * 5 * 1.07f), 16);
    l3.setFont(new Font("宋体", Font.BOLD, 15));
    l3.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 100);
    money = new JTextField();
    money.setSize(150, 20);
    money.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 100 - 3);

    JLabel l4 = new JLabel("付款账号:");
    l4.setSize((int) (16 * 5 * 1.07f), 16);
    l4.setFont(new Font("宋体", Font.BOLD, 15));
    l4.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 150);
    bankcard = new JTextField();
    bankcard.setSize(150, 20);
    bankcard.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 150 - 3);

    JLabel l5 = new JLabel("备注:");
    l5.setSize((int) (16 * 3 * 1.07f), 16);
    l5.setFont(new Font("宋体", Font.BOLD, 15));
    l5.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 200);
    note = new JTextArea();
    note.setSize(200, 100);
    note.setBorder(BorderFactory.createEtchedBorder());
    note.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 200 - 3);

    JLabel l6 = new JLabel("付款条目:");
    l6.setSize((int) (16 * 5 * 1.07f), 16);
    l6.setFont(new Font("宋体", Font.BOLD, 15));
    l6.setLocation(600, 128 + 80);

    rent = new JRadioButton("租金", true);
    rent.setSize((int) (20 * 3 * 1.07f), 20);
    rent.setFont(new Font("宋体", Font.BOLD, 16));
    rent.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80);
    rent.setOpaque(false);

    deli_price = new JRadioButton("运费", false);
    deli_price.setSize((int) (20 * 3 * 1.07f), 20);
    deli_price.setFont(new Font("宋体", Font.BOLD, 16));
    deli_price.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80 + 30);
    deli_price.setOpaque(false);

    salary = new JRadioButton("人员工资", false);
    salary.setSize((int) (20 * 5 * 1.07f), 20);
    salary.setFont(new Font("宋体", Font.BOLD, 16));
    salary.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80 + 60);
    salary.setOpaque(false);

    reward = new JRadioButton("奖励", false);
    reward.setSize((int) (20 * 3 * 1.07f), 20);
    reward.setFont(new Font("宋体", Font.BOLD, 16));
    reward.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80 + 90);
    reward.setOpaque(false);

    buttonGroup = new ButtonGroup();
    buttonGroup.add(rent);
    buttonGroup.add(deli_price);
    buttonGroup.add(salary);
    buttonGroup.add(reward);

    JLabel l7 = new JLabel("新建付款单:");
    l7.setSize((int) (16 * 6 * 1.07f), 16);
    l7.setFont(new Font("宋体", Font.BOLD, 15));
    l7.setLocation(596 - 30 / 2 - (int) (16 * 6 * 1.07f), 600 + 5);
    confirm.setLocation(596 - 30 / 2, 600);

    add(titleLabel);
    add(funLabel);
    add(currentuserAgencyNameLabel);
    add(currentuserLabel);
    add(currentusernameLabel);

    add(close);
    add(min);
    add(_return);
    add(goto_AccountManage);
    add(goto_CostManage);
    add(goto_SettlementManage);
    add(goto_Statistic);
    add(goto_BaseDataSetting);
    add(goto_SystemLog);

    add(id);
    add(l1);
    add(pay_man);
    add(l2);
    add(pay_date);
    add(l3);
    add(money);
    add(l4);
    add(bankcard);
    add(l5);
    add(note);
    add(l6);

    add(rent);
    add(deli_price);
    add(salary);
    add(reward);

    add(l7);
    add(confirm);
  }
  @SuppressWarnings("static-access")
  public editSalary(SalaryVO vo, JFrame main, LoginPO loginPO) {
    editSalary editSalary = this;
    setBounds(100, 100, 750, 600);
    setLayout(null);
    this.setVisible(true);
    // first
    rdbtnNewRadioButton = new JRadioButton("\u6309\u6708");
    rdbtnNewRadioButton.setOpaque(false);
    rdbtnNewRadioButton.setBorder(null);
    rdbtnNewRadioButton.setBounds(371, 290, 83, 23);
    rdbtnNewRadioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = SalaryModel.ByMonth;
          }
        });
    add(rdbtnNewRadioButton);

    // second
    radioButton = new JRadioButton("\u6309\u6B21");
    radioButton.setBounds(371, 326, 83, 23);
    radioButton.setOpaque(false);
    radioButton.setBorder(null);
    radioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByTimes;
          }
        });
    add(radioButton);

    // third
    radioButton_1 = new JRadioButton("\u6309\u63D0\u6210");
    radioButton_1.setBounds(371, 366, 100, 23);
    radioButton_1.setOpaque(false);
    radioButton_1.setBorder(null);
    radioButton_1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByBenefit;
          }
        });
    add(radioButton_1);

    buttonGroup = new ButtonGroup();
    buttonGroup.add(rdbtnNewRadioButton);
    buttonGroup.add(radioButton);
    buttonGroup.add(radioButton_1);

    if (vo.getTypeOfStrategy() == SalaryModel.ByMonth) {
      rdbtnNewRadioButton.setSelected(true);
      salaryModel = SalaryModel.ByMonth;
    } else if (vo.getTypeOfStrategy() == salaryModel.ByTimes) {
      radioButton.setSelected(true);
      salaryModel = salaryModel.ByTimes;
    } else {
      radioButton_1.setSelected(true);
      salaryModel = salaryModel.ByBenefit;
    }

    JButton btnNewButton = new JButton("\u786E\u5B9A");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int n = JOptionPane.showConfirmDialog(null, "确认修改?", "no", JOptionPane.YES_NO_OPTION);
            if (n == JOptionPane.YES_OPTION) {
              if (textField_1.getText().equals("")) {
                label_4.setText("请输入价格");
                Thread thread = new Thread(editSalary);
                thread.start();
              } else {
                SalaryVO salaryVO =
                    new SalaryVO(
                        textField.getText(),
                        Double.parseDouble(textField_1.getText()),
                        salaryModel);
                SalaryPolicybl salaryPolicybl = new SalaryPolicybl();
                salaryPolicybl.editSalary(salaryVO);
                Salary salary = new Salary(salaryVO, main, loginPO);
                main.remove(editSalary);
                main.getContentPane().add(salary);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    btnNewButton.setBounds(283, 419, 52, 52);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");
    Image temp1 =
        image1
            .getImage()
            .getScaledInstance(
                btnNewButton.getWidth(), btnNewButton.getHeight(), image1.getImage().SCALE_DEFAULT);
    image1 = new ImageIcon(temp1);
    btnNewButton.setIcon(image1);
    btnNewButton.setContentAreaFilled(false);
    btnNewButton.setBorderPainted(false);
    add(btnNewButton);

    JButton button = new JButton("");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Salary salary = new Salary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(salary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(new ImageIcon("image/transparent_circle.png"));
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });

    add(button);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(373, 189, 108, 21);
    textField.setText(vo.getTypeOfStaff());
    textField.setEnabled(false);
    textField.setForeground(new Color(88, 93, 103));
    textField.setCaretColor(new Color(88, 93, 103));
    textField.setOpaque(false);
    textField.setBorder(null);
    add(textField);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setDocument(new JTextFieldLimit(7));
    textField_1.setBounds(373, 239, 108, 21);
    textField_1.addKeyListener(new InputNumber());
    textField_1.setText(vo.getSalary() + "");
    textField_1.setForeground(new Color(88, 93, 103));
    textField_1.setCaretColor(new Color(88, 93, 103));
    textField_1.setOpaque(false);
    textField_1.setBorder(null);
    add(textField_1);

    JToolBar toolBar = new JToolBar();
    toolBar.setBounds(8, 541, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    label_4 = new JLabel("\u72B6\u6001\u680F");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    JButton button2 = new JButton("取消");
    button2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editSalary neweditSalary = new editSalary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(neweditSalary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });

    button2.setBounds(416, 418, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    Image temp2 =
        image2
            .getImage()
            .getScaledInstance(
                button2.getWidth(), button2.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp2);
    button2.setIcon(image2);
    button2.setContentAreaFilled(false);
    button2.setBorderPainted(false);
    add(button2);
  }
Ejemplo n.º 11
0
  public CommonPanel(JFrame ownerFrame, IFileSelector fileSelectionPanel) {
    //		try {
    //			FileHandler fh = new FileHandler("log.txt");
    //			Logger.getLogger(CommonPanel.class.getName()).addHandler(fh);
    //		}catch(IOException ex) {
    //			Logger.getLogger(CommonPanel.class.getName()).log(Level.SEVERE, null, ex);
    //		}catch(SecurityException ex) {
    //			Logger.getLogger(CommonPanel.class.getName()).log(Level.SEVERE, null, ex);
    //		}
    this.ownerFrame = ownerFrame;
    this.fileSelectionPanel = fileSelectionPanel;
    this.fontSizeTF = new JTextField(4);
    fontSizeTF.setToolTipText("Enter the font size, e.g. 12, 10.5, 22.7");
    fontSizeTF.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (!fontSizeSpecRB.isSelected()) fontSizeSpecRB.setSelected(true);
          }
        });
    fontSizeTF.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            super.mousePressed(e);
            if (!fontSizeSpecRB.isSelected()) fontSizeSpecRB.setSelected(true);
            System.out.println("fontSizeTF mousePressed");
          }

          @Override
          public void mouseExited(MouseEvent e) {
            MouseEvent event =
                new MouseEvent(
                    fontSizeSpecRB,
                    e.getID(),
                    e.getWhen(),
                    e.getModifiers(),
                    1,
                    1,
                    1,
                    e.isPopupTrigger(),
                    e.getButton());
            fontSizeSpecRB.dispatchEvent(event);
          }

          @Override
          public void mouseEntered(MouseEvent e) {
            MouseEvent event =
                new MouseEvent(
                    fontSizeSpecRB,
                    e.getID(),
                    e.getWhen(),
                    e.getModifiers(),
                    1,
                    1,
                    1,
                    e.isPopupTrigger(),
                    e.getButton());
            fontSizeSpecRB.dispatchEvent(event);
          }
        });
    String fontSizeRBToolTip =
        "<html>When this option is selected it enforces that"
            + "<br> the entered font size is used when creating the output file.";
    this.fontSizeSpecRB = new JRadioButton("Use the font size ");
    fontSizeSpecRB.setOpaque(false);
    fontSizeSpecRB.setToolTipText(fontSizeRBToolTip);
    JPanel fontSizeSpecPanel = new JPanel();
    fontSizeSpecPanel.setToolTipText(fontSizeRBToolTip);
    // pass events to radiobutton
    fontSizeSpecPanel.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            MouseEvent event =
                new MouseEvent(
                    fontSizeSpecRB,
                    e.getID(),
                    e.getWhen(),
                    e.getModifiers(),
                    1,
                    1,
                    1,
                    e.isPopupTrigger(),
                    e.getButton());
            fontSizeSpecRB.dispatchEvent(event);
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            MouseEvent event =
                new MouseEvent(
                    fontSizeSpecRB,
                    e.getID(),
                    e.getWhen(),
                    e.getModifiers(),
                    1,
                    1,
                    e.getClickCount(),
                    e.isPopupTrigger(),
                    e.getButton());
            fontSizeSpecRB.dispatchEvent(event);
          }

          @Override
          public void mouseExited(MouseEvent e) {
            MouseEvent event =
                new MouseEvent(
                    fontSizeSpecRB,
                    e.getID(),
                    e.getWhen(),
                    e.getModifiers(),
                    1,
                    1,
                    e.getClickCount(),
                    e.isPopupTrigger(),
                    e.getButton());
            fontSizeSpecRB.dispatchEvent(event);
          }

          @Override
          public void mouseEntered(MouseEvent e) {
            MouseEvent event =
                new MouseEvent(
                    fontSizeSpecRB,
                    e.getID(),
                    e.getWhen(),
                    e.getModifiers(),
                    1,
                    1,
                    e.getClickCount(),
                    e.isPopupTrigger(),
                    e.getButton());
            fontSizeSpecRB.dispatchEvent(event);
          }
        });
    fontSizeSpecPanel.add(fontSizeSpecRB);
    fontSizeSpecPanel.add(fontSizeTF);
    fontSizeSpecPanel.setBorder(BorderFactory.createEtchedBorder());
    fontSizeSpecPanel.setOpaque(false);
    this.fitTextToWidthRB = new JRadioButton("Fit text to page width ");
    fitTextToWidthRB.setBorder(BorderFactory.createEtchedBorder());
    fitTextToWidthRB.setBorderPainted(true);
    fitTextToWidthRB.setOpaque(false);
    fitTextToWidthRB.setToolTipText(
        "<html>Don't care about the font size, but make sure"
            + "<br> the width of input file content will fit into "
            + "<br>a whole width of a 'pdf' page.");

    ButtonGroup fontBG = new ButtonGroup();
    fontBG.add(fontSizeSpecRB);
    fontBG.add(fitTextToWidthRB);
    fitTextToWidthRB.setSelected(true);

    double p = TableLayout.PREFERRED;
    TableLayout fontSelectPL =
        new TableLayout(new double[] {.5, p, p, p, .5}, new double[] {.5, p, .5});
    JPanel fontSelectP = new JPanel(fontSelectPL);
    fontSelectP.setOpaque(false);
    fontSelectP.add(fontSizeSpecPanel, "1,1,L,C");
    fontSelectP.add(new JLabel(" or "), "2,1,C,C");
    fontSelectP.add(fitTextToWidthRB, "3,1,R,F");

    String[] fonts = {
      BaseFont.COURIER,
      BaseFont.HELVETICA,
      BaseFont.SYMBOL,
      BaseFont.TIMES_ROMAN,
      BaseFont.ZAPFDINGBATS
    }; // , "fonts/lucon.ttf"};
    // load font files from the fonts folder
    String fontFolder = "fonts";
    String[] fontFileNames = new String[0];
    //		Logger.getLogger(CommonPanel.class.getName()).log(Level.INFO,
    //				"ownerFrame must be instanceof Txt2PDFConverterIN is it?="
    //				+(ownerFrame instanceof Txt2PDFConverterIN)
    //				+"; ownerFrame.getClass().getName()="+ownerFrame.getClass().getName());
    if (ownerFrame instanceof Txt2PDFConverterIN)
      try {
        fontFileNames = getResourceListing(this.getClass(), fontFolder + "/");
      } catch (Exception ex) {
        // ignore, it could happen when fonts folder doesn't exist, it does
        // happen when debugging since the folder doesn't exist.
        // But the folder always is packed in the compact(IN) version of the program.
      }
    else {
      fontFileNames = new File(fontFolder).list();
    }
    //		Logger.getLogger(CommonPanel.class.getName()).log(Level.INFO,
    //				"fontFileNames=" + Arrays.toString(fontFileNames));
    int initialFontsSize = fonts.length;
    if (fontFileNames.length > 0) {
      int newFontsSize = initialFontsSize + fontFileNames.length;
      fonts = Arrays.copyOf(fonts, newFontsSize);
      for (int i = initialFontsSize; i < newFontsSize; i++)
        fonts[i] = fontFolder + "/" + fontFileNames[i - initialFontsSize];
    }
    this.fontCB = new JComboBox(fonts);
    fontCB.setBorder(BorderFactory.createEtchedBorder());
    fontCB.setToolTipText("Select the font to use for output.");
    String[] encodings = {BaseFont.CP1252, BaseFont.CP1250, BaseFont.CP1257, BaseFont.MACROMAN};
    this.encodingCB = new JComboBox(encodings);
    encodingCB.setBorder(BorderFactory.createEtchedBorder());
    encodingCB.setToolTipText("Select encoding used by the input file.");
    this.portraitRB = new JRadioButton("Portrait ");
    portraitRB.setBorder(BorderFactory.createEtchedBorder());
    portraitRB.setBorderPainted(true);
    portraitRB.setOpaque(false);
    portraitRB.setToolTipText("The output file will have pages in portrait orientation.");
    this.landscapeRB = new JRadioButton("Landscape ");
    landscapeRB.setBorder(BorderFactory.createEtchedBorder());
    landscapeRB.setBorderPainted(true);
    landscapeRB.setOpaque(false);
    landscapeRB.setToolTipText("The output file will have pages in landscape orientation.");
    ButtonGroup pageOrientBG = new ButtonGroup();
    pageOrientBG.add(portraitRB);
    pageOrientBG.add(landscapeRB);
    portraitRB.setSelected(true);

    // panel with page orientation settings
    TableLayout pageOrientPL =
        new TableLayout(new double[] {5, p, p, p, 5}, new double[] {TableLayout.FILL});
    JPanel pageOrientP = new JPanel(pageOrientPL);
    pageOrientP.setOpaque(false);
    pageOrientP.add(portraitRB, "1,0,L,F");
    pageOrientP.add(new JLabel(" or "), "2,0,C,C");
    pageOrientP.add(landscapeRB, "3,0,R,F");
    pageOrientP.setBorder(BorderFactory.createEtchedBorder());

    TableLayout encodeOrientPL =
        new TableLayout(
            new double[] {10, p, 5, p, TableLayout.FILL, p, 10}, new double[] {.5, p, .5});
    JPanel fontEncodeOrientP = new JPanel(encodeOrientPL);
    fontEncodeOrientP.setOpaque(false);
    fontEncodeOrientP.add(fontCB, "1,1,L,F");
    fontEncodeOrientP.add(encodingCB, "3,1,L,F");
    fontEncodeOrientP.add(pageOrientP, "5,1,R,F");

    this.overwriteOutputFileChB = new JCheckBox("Overwrite output file ");
    overwriteOutputFileChB.setToolTipText(
        "When selected it will overwrite the output file if it exists.");
    overwriteOutputFileChB.setBorder(BorderFactory.createEtchedBorder());
    overwriteOutputFileChB.setBorderPainted(true);
    overwriteOutputFileChB.setOpaque(false);
    int bW = 80;
    int bH = 30;
    this.convertB = new JButton(copnvertAction);
    convertB.setPreferredSize(new Dimension(bW, bH));
    convertB.setToolTipText("Convert the input 'txt' file applying all the selected settings.");
    this.exitB = new JButton(exitAction);
    exitB.setPreferredSize(new Dimension(bW, bH));
    exitB.setToolTipText("Exit the program.");
    TableLayout buttonPL =
        new TableLayout(new double[] {.25, p, .5, p, .25}, new double[] {5, p, 5});
    JPanel buttonP = new JPanel(buttonPL);
    buttonP.setOpaque(false);
    buttonP.add(convertB, "1,1,C,C");
    buttonP.add(exitB, "3,1,C,C");

    JLabel infoL = new JLabel("<html><p>&nbsp Select conversion settings.</p>");
    TableLayout layout =
        new TableLayout(
            new double[] {.5, p, .5}, new double[] {.5, p, 5, p, 5, p, 5, p, 10, p, .5});
    setLayout(layout);
    add(infoL, "1,1,L,C");
    add(fontSelectP, "1,3,F,C");
    add(fontEncodeOrientP, "1,5,F,C");
    add(overwriteOutputFileChB, "1,7,C,F");
    add(buttonP, "1,9,F,C");
  }
Ejemplo n.º 12
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);
  }
Ejemplo n.º 13
0
    /**
     * Vytvori dotazovaci dialog s prednastavenym layoutem, nastavi jeho pozici a vykresli jej na
     * obrazovku.
     *
     * @param owner Nadrazene okno {@code java.awt.Frame}.
     * @param title Jmeno dialogoveho okna.
     */
    CheckDialog(Frame owner, String title) {
      this.setTitle(title);
      this.setPreferredSize(new Dimension(200, 200));

      jdCont = new JPanel();
      jdCont.setPreferredSize(new Dimension(200, 200));

      bg = new ButtonGroup();

      ActionListener change =
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
              chngInfo(evt);
            }
          };

      opt1 = new JRadioButton("Sidlo");
      opt1.setBounds(10, 5, 10, 10);
      opt1.setSize(10, 10);
      opt1.setLocation(10, 5);
      opt1.setSelected(true);
      opt1.setOpaque(true);
      opt1.setActionCommand("settle");
      opt1.addActionListener(change);

      opt2 = new JRadioButton("Vrtulnik");
      opt2.setBounds(30, 5, 10, 10);
      opt2.setOpaque(true);
      opt2.setActionCommand("helicop");
      opt2.addActionListener(change);

      opt3 = new JRadioButton("Auto");
      opt3.setBounds(50, 5, 10, 10);
      opt3.setOpaque(true);
      opt3.setActionCommand("car");
      opt3.addActionListener(change);

      bg.add(opt1);
      bg.add(opt2);
      bg.add(opt3);

      info = new JLabel("ID musi byt v danem rozmezi!", JLabel.CENTER);

      line = new JTextField(10);
      // line.setBounds(10,20,100,20);
      // line.setSize(100, 20);
      // line.setAlignmentX(100);
      line.setEnabled(true);
      line.setOpaque(true);

      sender = new JButton();
      sender.setBounds(50, 50, 100, 20);
      sender.setBackground(new Color(200, 200, 200));
      sender.setEnabled(true);
      sender.setFont(new Font("sansserif", 0, 12));
      sender.setText("Zjistit!");
      sender.setVisible(true);
      sender.setOpaque(true);
      sender.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              send();
            }
          });

      jdCont.add(opt1);
      jdCont.add(opt2);
      jdCont.add(opt3);
      jdCont.add(info);
      jdCont.add(line);
      jdCont.add(sender);

      this.setContentPane(jdCont);
      // this.setPreferredSize(new Dimension(200,200));
      this.setLocationRelativeTo(owner);
      this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      this.pack();
      this.setVisible(true);
    }
Ejemplo n.º 14
0
  private View() {

    botonera = new ArrayList<JButton>();
    control = new Control(this);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 840, 640);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    llenar_botonera();

    button_1 = new JButton("");
    button_1.setBackground(Color.WHITE);
    button_1.setFont(new Font("Tahoma", Font.BOLD, 8));
    button_1.setForeground(Color.CYAN);
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            control.add_Bet(1);
          }
        });

    button_1.setBounds(632, 48, 61, 31);
    button_1.setOpaque(false);
    button_1.setContentAreaFilled(false);
    button_1.setBorderPainted(false);
    contentPane.add(button_1);

    //
    //		button_2 = new JButton("");
    //		button_2.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_2.setForeground(Color.CYAN);
    //		button_2.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(2);
    //			}
    //		});
    //		button_2.setBounds(692, 48, 61, 31);
    //		button_2.setOpaque(false);
    //		button_2.setContentAreaFilled(false);
    //		button_2.setBorderPainted(false);
    //		contentPane.add(button_2);
    //
    //
    //		button_3 = new JButton("");
    //		button_3.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_3.setForeground(Color.CYAN);
    //		button_3.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(3);
    //			}
    //		});
    //		button_3.setBounds(753, 48, 61, 31);
    //		button_3.setOpaque(false);
    //		button_3.setContentAreaFilled(false);
    //		button_3.setBorderPainted(false);
    //		contentPane.add(button_3);
    //
    //
    //		button_4 = new JButton("");
    //		button_4.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_4.setForeground(Color.CYAN);
    //		button_4.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(4);
    //			}
    //		});
    //		button_4.setBounds(632, 79, 61, 31);
    //		button_4.setOpaque(false);
    //		button_4.setContentAreaFilled(false);
    //		button_4.setBorderPainted(false);
    //		contentPane.add(button_4);
    //
    //		button_5 = new JButton("");
    //		button_5.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_5.setForeground(Color.CYAN);
    //		button_5.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(5);
    //			}
    //		});
    //
    //		button_5.setOpaque(false);
    //		button_5.setContentAreaFilled(false);
    //		button_5.setBorderPainted(false);
    //		button_5.setBounds(692, 79, 61, 31);
    //		contentPane.add(button_5);
    //
    //		button_6 = new JButton("");
    //		button_6.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_6.setForeground(Color.CYAN);
    //		button_6.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(6);
    //			}
    //		});
    //		button_6.setOpaque(false);
    //		button_6.setContentAreaFilled(false);
    //		button_6.setBorderPainted(false);
    //		button_6.setBounds(753, 79, 61, 31);
    //		contentPane.add(button_6);
    //
    //		button_7 = new JButton("");
    //		button_7.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_7.setForeground(Color.CYAN);
    //		button_7.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(7);
    //			}
    //		});
    //		button_7.setOpaque(false);
    //		button_7.setContentAreaFilled(false);
    //		button_7.setBorderPainted(false);
    //		button_7.setBounds(632, 108, 61, 31);
    //		contentPane.add(button_7);
    //
    //		button_8 = new JButton("");
    //		button_8.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_8.setForeground(Color.CYAN);
    //		button_8.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(8);
    //			}
    //		});
    //		button_8.setOpaque(false);
    //		button_8.setContentAreaFilled(false);
    //		button_8.setBorderPainted(false);
    //		button_8.setBounds(692, 108, 61, 31);
    //		contentPane.add(button_8);
    //
    //		button_9 = new JButton("");
    //		button_9.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_9.setForeground(Color.CYAN);
    //		button_9.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(9);
    //			}
    //		});
    //		button_9.setOpaque(false);
    //		button_9.setContentAreaFilled(false);
    //		button_9.setBorderPainted(false);
    //		button_9.setBounds(753, 108, 61, 31);
    //		contentPane.add(button_9);
    //
    //		button_10 = new JButton("");
    //		button_10.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_10.setForeground(Color.CYAN);
    //		button_10.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(10);
    //			}
    //		});
    //		button_10.setOpaque(false);
    //		button_10.setContentAreaFilled(false);
    //		button_10.setBorderPainted(false);
    //		button_10.setBounds(632, 150, 61, 31);
    //		contentPane.add(button_10);
    //
    //		button_11 = new JButton("");
    //		button_11.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_11.setForeground(Color.CYAN);
    //		button_11.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(11);
    //
    //			}
    //		});
    //		button_11.setOpaque(false);
    //		button_11.setContentAreaFilled(false);
    //		button_11.setBorderPainted(false);
    //		button_11.setBounds(692, 150, 61, 31);
    //		contentPane.add(button_11);
    //
    //		button_12 = new JButton("");
    //		button_12.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_12.setForeground(Color.CYAN);
    //		button_12.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(12);
    //			}
    //		});
    //		button_12.setOpaque(false);
    //		button_12.setContentAreaFilled(false);
    //		button_12.setBorderPainted(false);
    //		button_12.setBounds(753, 150, 61, 31);
    //		contentPane.add(button_12);
    //
    //		button_13 = new JButton("");
    //		button_13.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_13.setForeground(Color.CYAN);
    //		button_13.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(13);
    //
    //			}
    //		});
    //		button_13.setOpaque(false);
    //		button_13.setContentAreaFilled(false);
    //		button_13.setBorderPainted(false);
    //		button_13.setBounds(632, 181, 61, 31);
    //		contentPane.add(button_13);
    //
    //		button_14 = new JButton("");
    //		button_14.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_14.setForeground(Color.CYAN);
    //		button_14.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(14);
    //			}
    //		});
    //		button_14.setOpaque(false);
    //		button_14.setContentAreaFilled(false);
    //		button_14.setBorderPainted(false);
    //		button_14.setBounds(692, 181, 61, 31);
    //		contentPane.add(button_14);
    //
    //		button_15 = new JButton("");
    //		button_15.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_15.setForeground(Color.CYAN);
    //		button_15.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(15);
    //			}
    //		});
    //		button_15.setOpaque(false);
    //		button_15.setContentAreaFilled(false);
    //		button_15.setBorderPainted(false);
    //		button_15.setBounds(753, 181, 61, 31);
    //		contentPane.add(button_15);
    //
    //		button_16 = new JButton("");
    //		button_16.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_16.setForeground(Color.CYAN);
    //		button_16.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(16);
    //			}
    //		});
    //		button_16.setOpaque(false);
    //		button_16.setContentAreaFilled(false);
    //		button_16.setBorderPainted(false);
    //		button_16.setBounds(632, 211, 61, 31);
    //		contentPane.add(button_16);
    //
    //		button_17 = new JButton("");
    //		button_17.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_17.setForeground(Color.CYAN);
    //		button_17.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(17);
    //			}
    //		});
    //		button_17.setOpaque(false);
    //		button_17.setContentAreaFilled(false);
    //		button_17.setBorderPainted(false);
    //		button_17.setBounds(692, 211, 61, 31);
    //		contentPane.add(button_17);
    //
    //		button_18 = new JButton("");
    //		button_18.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_18.setForeground(Color.CYAN);
    //		button_18.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(18);
    //			}
    //		});
    //		button_18.setOpaque(false);
    //		button_18.setContentAreaFilled(false);
    //		button_18.setBorderPainted(false);
    //		button_18.setBounds(753, 242, 61, 31);
    //		contentPane.add(button_18);
    //
    //		button_19 = new JButton("");
    //		button_19.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_19.setForeground(Color.CYAN);
    //		button_19.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(19);
    //			}
    //		});
    //		button_19.setOpaque(false);
    //		button_19.setContentAreaFilled(false);
    //		button_19.setBorderPainted(false);
    //		button_19.setBounds(632, 401, 61, 31);
    //		contentPane.add(button_19);
    //
    //		button_20 = new JButton("");
    //		button_20.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_20.setForeground(Color.CYAN);
    //		button_20.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(20);
    //			}
    //		});
    //		button_20.setOpaque(false);
    //		button_20.setContentAreaFilled(false);
    //		button_20.setBorderPainted(false);
    //		button_20.setBounds(692, 401, 61, 31);
    //		contentPane.add(button_20);
    //
    //		button_21 = new JButton("");
    //		button_21.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_21.setForeground(Color.CYAN);
    //		button_21.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(21);
    //			}
    //		});
    //		button_21.setOpaque(false);
    //		button_21.setContentAreaFilled(false);
    //		button_21.setBorderPainted(false);
    //		button_21.setBounds(753, 211, 61, 31);
    //		contentPane.add(button_21);
    //
    //		button_22 = new JButton("");
    //		button_22.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_22.setForeground(Color.CYAN);
    //		button_22.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(22);
    //			}
    //		});
    //		button_22.setOpaque(false);
    //		button_22.setContentAreaFilled(false);
    //		button_22.setBorderPainted(false);
    //		button_22.setBounds(632, 242, 61, 31);
    //		contentPane.add(button_22);
    //
    //		button_23 = new JButton("");
    //		button_23.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_23.setForeground(Color.CYAN);
    //		button_23.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(23);
    //			}
    //		});
    //		button_23.setOpaque(false);
    //		button_23.setContentAreaFilled(false);
    //		button_23.setBorderPainted(false);
    //		button_23.setBounds(692, 242, 61, 31);
    //		contentPane.add(button_23);
    //
    //		button_24 = new JButton("");
    //		button_24.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_24.setForeground(Color.CYAN);
    //		button_24.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(24);
    //			}
    //		});
    //		button_24.setOpaque(false);
    //		button_24.setContentAreaFilled(false);
    //		button_24.setBorderPainted(false);
    //		button_24.setBounds(753, 338, 61, 31);
    //		contentPane.add(button_24);
    //
    //		button_25 = new JButton("");
    //		button_25.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_25.setForeground(Color.CYAN);
    //		button_25.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(25);
    //
    //			}
    //		});
    //		button_25.setOpaque(false);
    //		button_25.setContentAreaFilled(false);
    //		button_25.setBorderPainted(false);
    //		button_25.setBounds(621, 276, 61, 31);
    //		contentPane.add(button_25);
    //
    //		button_26 = new JButton("");
    //		button_26.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_26.setForeground(Color.CYAN);
    //		button_26.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(26);
    //			}
    //		});
    //		button_26.setOpaque(false);
    //		button_26.setContentAreaFilled(false);
    //		button_26.setBorderPainted(false);
    //		button_26.setBounds(692, 276, 61, 31);
    //		contentPane.add(button_26);
    //
    //		button_27 = new JButton("");
    //		button_27.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_27.setForeground(Color.CYAN);
    //		button_27.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(27);
    //			}
    //		});
    //		button_27.setOpaque(false);
    //		button_27.setContentAreaFilled(false);
    //		button_27.setBorderPainted(false);
    //		button_27.setBounds(753, 276, 61, 31);
    //		contentPane.add(button_27);
    //
    //		 button_28 = new JButton("");
    //		button_28.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_28.setForeground(Color.CYAN);
    //		button_28.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(28);
    //			}
    //		});
    //		button_28.setOpaque(false);
    //		button_28.setContentAreaFilled(false);
    //		button_28.setBorderPainted(false);
    //		button_28.setBounds(632, 310, 61, 31);
    //		contentPane.add(button_28);
    //
    //		 button_29 = new JButton("");
    //		button_29.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_29.setForeground(Color.CYAN);
    //		button_29.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(29);
    //			}
    //		});
    //		button_29.setOpaque(false);
    //		button_29.setContentAreaFilled(false);
    //		button_29.setBorderPainted(false);
    //		button_29.setBounds(692, 310, 61, 31);
    //		contentPane.add(button_29);
    //
    //		 button_30 = new JButton("");
    //		button_30.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_30.setForeground(Color.CYAN);
    //		button_30.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(30);
    //			}
    //		});
    //		button_30.setOpaque(false);
    //		button_30.setContentAreaFilled(false);
    //		button_30.setBorderPainted(false);
    //		button_30.setBounds(753, 310, 61, 31);
    //		contentPane.add(button_30);
    //
    //		 button_31 = new JButton("");
    //		button_31.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_31.setForeground(Color.CYAN);
    //		button_31.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(31);
    //			}
    //		});
    //		button_31.setOpaque(false);
    //		button_31.setContentAreaFilled(false);
    //		button_31.setBorderPainted(false);
    //		button_31.setBounds(632, 338, 61, 31);
    //		contentPane.add(button_31);
    //
    //		 button_32 = new JButton("");
    //		button_32.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_32.setForeground(Color.CYAN);
    //		button_32.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(32);
    //			}
    //		});
    //		button_32.setOpaque(false);
    //		button_32.setContentAreaFilled(false);
    //		button_32.setBorderPainted(false);
    //		button_32.setBounds(692, 338, 61, 31);
    //		contentPane.add(button_32);
    //
    //		 button_33 = new JButton("");
    //		button_33.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_33.setForeground(Color.CYAN);
    //		button_33.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(33);
    //			}
    //		});
    //		button_33.setOpaque(false);
    //		button_33.setContentAreaFilled(false);
    //		button_33.setBorderPainted(false);
    //		button_33.setBounds(753, 401, 61, 31);
    //		contentPane.add(button_33);
    //
    //		 button_34 = new JButton("");
    //		button_34.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_34.setForeground(Color.CYAN);
    //		button_34.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(34);
    //			}
    //		});
    //		button_34.setOpaque(false);
    //		button_34.setContentAreaFilled(false);
    //		button_34.setBorderPainted(false);
    //		button_34.setBounds(632, 375, 61, 31);
    //		contentPane.add(button_34);
    //
    //		 button_35 = new JButton("");
    //		button_35.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_35.setForeground(Color.CYAN);
    //		button_35.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(35);
    //			}
    //		});
    //		button_35.setOpaque(false);
    //		button_35.setContentAreaFilled(false);
    //		button_35.setBorderPainted(false);
    //		button_35.setBounds(692, 375, 61, 31);
    //		contentPane.add(button_35);
    //
    //		 button_36 = new JButton("");
    //		button_36.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_36.setForeground(Color.CYAN);
    //		button_36.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(36);
    //			}
    //		});
    //		button_36.setOpaque(false);
    //		button_36.setContentAreaFilled(false);
    //		button_36.setBorderPainted(false);
    //		button_36.setBounds(753, 375, 61, 31);
    //		contentPane.add(button_36);
    //
    //		 button_0 = new JButton("");//ultimo numero
    //		button_0.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_0.setForeground(Color.CYAN);
    //		button_0.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(0);
    //			}
    //		});
    //		button_0.setOpaque(false);
    //		button_0.setContentAreaFilled(false);
    //		button_0.setBorderPainted(false);
    //		button_0.setBounds(632, 11, 182, 36);
    //		contentPane.add(button_0);
    //
    //		 button_37 = new JButton("");// rojo
    //		button_37.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_37.setForeground(Color.CYAN);
    //		button_37.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(37);
    //			}
    //		});
    //
    //		button_37.setOpaque(false);
    //		button_37.setContentAreaFilled(false);
    //		button_37.setBorderPainted(false);
    //		button_37.setBounds(499, 181, 61, 60);
    //		contentPane.add(button_37);
    //
    //		 button_38 = new JButton("");//negro
    //		button_38.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_38.setForeground(Color.CYAN);
    //		button_38.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(38);
    //			}
    //		});
    //		button_38.setOpaque(false);
    //		button_38.setContentAreaFilled(false);
    //		button_38.setBorderPainted(false);
    //		button_38.setBounds(499, 242, 61, 62);
    //		contentPane.add(button_38);
    //
    //		 button_39 = new JButton("");//par
    //		button_39.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_39.setForeground(Color.CYAN);
    //		button_39.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(39);
    //			}
    //		});
    //		button_39.setOpaque(false);
    //		button_39.setContentAreaFilled(false);
    //		button_39.setBorderPainted(false);
    //		button_39.setBounds(499, 48, 61, 129);
    //		contentPane.add(button_39);
    //
    //		 button_40 = new JButton("");//impar
    //		button_40.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_40.setForeground(Color.CYAN);
    //		button_40.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(40);
    //			}
    //		});
    //		button_40.setOpaque(false);
    //		button_40.setContentAreaFilled(false);
    //		button_40.setBorderPainted(false);
    //		button_40.setBounds(499, 310, 61, 122);
    //		contentPane.add(button_40);
    //
    //		 button_41 = new JButton("");//1de12
    //		button_41.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_41.setForeground(Color.CYAN);
    //		button_41.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(41);
    //			}
    //		});
    //
    //		button_41.setOpaque(false);
    //		button_41.setContentAreaFilled(false);
    //		button_41.setBorderPainted(false);
    //		button_41.setBounds(561, 48, 61, 129);
    //		contentPane.add(button_41);
    //
    //		button_42 = new JButton("");//2 de 12
    //		button_42.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_42.setForeground(Color.CYAN);
    //		button_42.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(42);
    //			}
    //		});
    //		button_42.setOpaque(false);
    //		button_42.setContentAreaFilled(false);
    //		button_42.setBorderPainted(false);
    //		button_42.setBounds(561, 180, 61, 127);
    //		contentPane.add(button_42);
    //
    //		button_43 = new JButton("");//3 de 12
    //		button_43.setFont(new Font("Tahoma", Font.BOLD, 8));
    //		button_43.setForeground(Color.CYAN);
    //		button_43.addMouseListener(new MouseAdapter() {
    //			@Override
    //			public void mouseClicked(MouseEvent arg0) {
    //				control.add_Bet(43);
    //			}
    //		});
    //
    //		button_43.setOpaque(false);
    //		button_43.setContentAreaFilled(false);
    //		button_43.setBorderPainted(false);
    //		button_43.setBounds(561, 311, 61, 121);
    //		contentPane.add(button_43);
    //
    JButton btnNewButton = new JButton("SPIN");
    btnNewButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            control.Girar();
          }
        });

    btnNewButton.setBounds(499, 456, 89, 41);
    contentPane.add(btnNewButton);

    JButton btnBet = new JButton("CLEAR");
    btnBet.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            control.devolver_Apuesta();
          }
        });
    btnBet.setBounds(611, 456, 89, 41);
    contentPane.add(btnBet);

    JButton btnExit = new JButton("RESTART");
    btnExit.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {

            control.restart();
          }
        });
    btnExit.setBounds(725, 456, 89, 41);
    contentPane.add(btnExit);

    txtLhbkj = new JTextField();
    txtLhbkj.setFont(new Font("Tahoma", Font.PLAIN, 40));
    txtLhbkj.setBounds(496, 531, 318, 60);
    contentPane.add(txtLhbkj);
    txtLhbkj.setColumns(10);

    textField = new JTextField();
    textField.setFont(new Font("Tunga", Font.PLAIN, 40));
    textField.setHorizontalAlignment(SwingConstants.CENTER);
    textField.setBounds(164, 483, 151, 85);
    contentPane.add(textField);
    textField.setColumns(10);

    radioButton = new JRadioButton("50");
    radioButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            control.set_Ficha(50);
          }
        });

    radioButton.setOpaque(false);
    radioButton.setContentAreaFilled(false);
    radioButton.setBorderPainted(false);
    radioButton.setBounds(424, 357, 58, 23);
    contentPane.add(radioButton);

    radioButton_1 = new JRadioButton("100");
    radioButton_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            control.set_Ficha(100);
          }
        });

    radioButton_1.setOpaque(false);
    radioButton_1.setContentAreaFilled(false);
    radioButton_1.setBorderPainted(false);
    radioButton_1.setBounds(424, 383, 58, 23);
    contentPane.add(radioButton_1);

    rdbtnNewRadioButton = new JRadioButton("500");
    rdbtnNewRadioButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            control.set_Ficha(500);
          }
        });

    rdbtnNewRadioButton.setOpaque(false);
    rdbtnNewRadioButton.setContentAreaFilled(false);
    rdbtnNewRadioButton.setBorderPainted(false);
    rdbtnNewRadioButton.setBounds(424, 409, 58, 23);
    contentPane.add(rdbtnNewRadioButton);

    JLabel lblNewLabel = new JLabel("New label");
    lblNewLabel.setIcon(
        new ImageIcon("C:\\Users\\Matias\\Desktop\\Eclipse\\TPRuleta\\ruletaa.jpg"));
    lblNewLabel.setBounds(0, 0, 834, 640);
    contentPane.add(lblNewLabel);

    radioButton.setSelected(true);
    radioButton_1.setSelected(false);
    rdbtnNewRadioButton.setSelected(false);

    radioButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            control.set_Ficha(50);
          }
        });

    radioButton_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            control.set_Ficha(100);
          }
        });

    rdbtnNewRadioButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            control.set_Ficha(500);
          }
        });
  }
Ejemplo n.º 15
0
  // Must be delegated through ActionFrame(Action)
  private ActionFrame(Action a, LibAction la) {
    super(la.description, false);
    if (la.parent == null) setTitle(Messages.getString("Action.UNKNOWN")); // $NON-NLS-1$
    if (la.actImage != null)
      setFrameIcon(new ImageIcon(la.actImage.getScaledInstance(16, 16, Image.SCALE_SMOOTH)));
    String s;
    ResourceReference<GmObject> at = a.getAppliesTo();
    if (at == GmObject.OBJECT_SELF) s = Messages.getString("ActionFrame.SELF"); // $NON-NLS-1$
    else s = Messages.getString("ActionFrame.OTHER"); // $NON-NLS-1$
    appliesObject = new ResourceMenu<GmObject>(Resource.Kind.OBJECT, s, false, 100);
    appliesObject.setEnabled(GmObject.refAsInt(at) >= 0);
    appliesObject.setOpaque(false);
    appliesObject.setSelected(at);
    act = a;

    appliesPanel = new JPanel();
    appliesPanel.setOpaque(false);
    appliesPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc;
    applies = new IndexButtonGroup(3, true, false);
    JRadioButton button = new JRadioButton(Messages.getString("ActionFrame.SELF")); // $NON-NLS-1$
    button.setOpaque(false);
    applies.add(button, -1);
    gbc = new GridBagConstraints();
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    appliesPanel.add(button, gbc);
    button = new JRadioButton(Messages.getString("ActionFrame.OTHER")); // $NON-NLS-1$
    button.setOpaque(false);
    applies.add(button, -2);
    gbc = new GridBagConstraints();
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    appliesPanel.add(button, gbc);
    button = new JRadioButton(Messages.getString("ActionFrame.OBJECT")); // $NON-NLS-1$
    button.setHorizontalAlignment(JRadioButton.LEFT);
    button.setOpaque(false);
    button.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            boolean sel = ((JRadioButton) e.getSource()).isSelected();
            appliesObject.setEnabled(sel);
          }
        });
    applies.add(button, 0);
    gbc = new GridBagConstraints();
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    appliesPanel.add(button, gbc);
    gbc = new GridBagConstraints();
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    gbc.insets = new Insets(0, 2, 0, 6);
    appliesPanel.add(appliesObject, gbc);
    applies.setValue(Math.min(GmObject.refAsInt(at), 0));

    if (la.interfaceKind == LibAction.INTERFACE_CODE) {
      setSize(600, 400);
      setClosable(true);
      setMaximizable(true);
      setResizable(true);
      setIconifiable(true);

      tool = new JToolBar();
      tool.setFloatable(false);
      tool.setAlignmentX(0);
      save = new JButton(LGM.getIconForKey("ActionFrame.SAVE")); // $NON-NLS-1$
      save.addActionListener(this);
      //			add(save);
      tool.add(save);
      tool.addSeparator();

      code = new GMLTextArea(a.getArguments().get(0).getVal());
      code.addEditorButtons(tool);

      tool.addSeparator();
      tool.add(new JLabel(Messages.getString("ActionFrame.APPLIES"))); // $NON-NLS-1$
      tool.add(appliesPanel);

      status = new JPanel(new FlowLayout());
      status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS));
      status.setMaximumSize(new Dimension(Integer.MAX_VALUE, 11));
      final JLabel caretPos =
          new JLabel((code.getCaretLine() + 1) + ":" + (code.getCaretColumn() + 1));
      status.add(caretPos);
      code.addCaretListener(
          new CaretListener() {
            public void caretUpdate(CaretEvent e) {
              caretPos.setText((code.getCaretLine() + 1) + ":" + (code.getCaretColumn() + 1));
            }
          });

      add(tool, BorderLayout.NORTH);
      add(code, BorderLayout.CENTER);
      add(status, BorderLayout.SOUTH);

      setFocusTraversalPolicy(new TextAreaFocusTraversalPolicy(code));
      appliesPanel.setLayout(new BoxLayout(appliesPanel, BoxLayout.LINE_AXIS));
    } else makeArgumentPane(a, la);
    pack();
    repaint();
    SubframeInformer.fireSubframeAppear(this);
  }
Ejemplo n.º 16
0
  /** Creates the GUI. */
  public void majorLayout() {
    //
    // Setup Menu
    //
    JMenuBar menuBar = new JMenuBar();
    JMenu file = new JMenu(ResourceHandler.getMessage("menu.file"));
    file.setMnemonic(ResourceHandler.getAcceleratorKey("menu.file"));

    file.add(exitMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.exit")));
    exitMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.exit"));
    exitMenuItem.addActionListener(this);
    menuBar.add(file);

    JMenu edit = new JMenu(ResourceHandler.getMessage("menu.edit"));
    edit.setMnemonic(ResourceHandler.getAcceleratorKey("menu.edit"));

    edit.add(optionMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.option")));
    optionMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.option"));
    optionMenuItem.addActionListener(this);
    menuBar.add(edit);

    JMenu help = new JMenu(ResourceHandler.getMessage("menu.help"));
    help.setMnemonic(ResourceHandler.getAcceleratorKey("menu.help"));

    help.add(helpMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.help")));
    helpMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.help"));

    help.add(new JSeparator());
    help.add(aboutMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.about")));
    aboutMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.about"));
    helpMenuItem.addActionListener(this);
    aboutMenuItem.addActionListener(this);
    menuBar.add(help);

    setJMenuBar(menuBar);

    //
    // Setup main GUI
    //

    dirLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel0"));
    dirTF = new JTextField();
    dirBttn = new JButton(ResourceHandler.getMessage("button.browse.dir"));
    dirBttn.setMnemonic(ResourceHandler.getAcceleratorKey("button.browse.dir"));

    matchingLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel1"));
    matchingTF = new JTextField(ResourceHandler.getMessage("converter_gui.lablel2"));
    recursiveCheckBox = new JCheckBox(ResourceHandler.getMessage("converter_gui.lablel3"));
    recursiveCheckBox.setMnemonic(ResourceHandler.getAcceleratorKey("converter_gui.lablel3"));

    backupLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel5"));
    backupTF = new JTextField();
    backupBttn = new JButton(ResourceHandler.getMessage("button.browse.backup"));
    backupBttn.setMnemonic(ResourceHandler.getAcceleratorKey("button.browse.backup"));

    templateLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel7"));
    templateCh = new TemplateFileChoice();

    staticVersioningLabel = new JLabel(ResourceHandler.getMessage("static.versioning.label"));
    String version = System.getProperty("java.version");
    if (version.indexOf("-") > 0) {
      version = version.substring(0, version.indexOf("-"));
    }
    int dotIndex = version.indexOf(".");
    dotIndex = version.indexOf(".", dotIndex + 1);
    String familyVersion = version.substring(0, dotIndex);

    MessageFormat formatter =
        new MessageFormat(ResourceHandler.getMessage("static.versioning.radio.button"));
    staticVersioningRadioButton = new JRadioButton(formatter.format(new Object[] {version}));
    staticVersioningRadioButton.setMnemonic(
        ResourceHandler.getAcceleratorKey("static.versioning.radio.button"));

    formatter = new MessageFormat(ResourceHandler.getMessage("dynamic.versioning.radio.button"));
    dynamicVersioningRadioButton = new JRadioButton(formatter.format(new Object[] {familyVersion}));
    dynamicVersioningRadioButton.setMnemonic(
        ResourceHandler.getAcceleratorKey("dynamic.versioning.radio.button"));

    staticVersioningTextArea = new JTextArea(ResourceHandler.getMessage("static.versioning.text"));

    formatter = new MessageFormat(ResourceHandler.getMessage("dynamic.versioning.text"));
    dynamicVersioningTextArea = new JTextArea(formatter.format(new Object[] {familyVersion}));

    ButtonGroup versioningButtonGroup = new ButtonGroup();
    versioningButtonGroup.add(staticVersioningRadioButton);
    versioningButtonGroup.add(dynamicVersioningRadioButton);

    runBttn = new JButton(ResourceHandler.getMessage("button.convert"));
    runBttn.setMnemonic(ResourceHandler.getAcceleratorKey("button.convert"));

    recursiveCheckBox.setOpaque(false);
    staticVersioningRadioButton.setOpaque(false);
    dynamicVersioningRadioButton.setOpaque(false);

    staticVersioningTextArea.setEditable(false);
    staticVersioningTextArea.setLineWrap(true);
    staticVersioningTextArea.setWrapStyleWord(true);
    dynamicVersioningTextArea.setEditable(false);
    dynamicVersioningTextArea.setLineWrap(true);
    dynamicVersioningTextArea.setWrapStyleWord(true);

    staticVersioningPanel.setLayout(new BorderLayout());
    staticVersioningPanel.add(staticVersioningTextArea, "Center");
    staticVersioningPanel.setBorder(new LineBorder(Color.black));

    dynamicVersioningPanel.setLayout(new BorderLayout());
    dynamicVersioningPanel.add(dynamicVersioningTextArea, "Center");
    dynamicVersioningPanel.setBorder(new LineBorder(Color.black));

    if (converter.isStaticVersioning()) {
      staticVersioningRadioButton.setSelected(true);
    } else {
      dynamicVersioningRadioButton.setSelected(true);
    }

    addListeners();

    final int buf = 10, // Buffer (between components and form)
        sp = 10, // Space between components
        vsp = 5, // Vertical space
        indent = 20; // Indent between form (left edge) and component

    GridBagConstraints gbc = new GridBagConstraints();
    GridBagLayout gbl = new GridBagLayout();
    getContentPane().setLayout(gbl);

    //
    // Setup top panel
    //
    GridBagLayout topLayout = new GridBagLayout();
    JPanel topPanel = new JPanel();
    topPanel.setOpaque(false);
    topPanel.setLayout(topLayout);

    topLayout.setConstraints(
        dirLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(10, 0, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        dirTF,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(vsp, 2, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        dirBttn,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(10, sp, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        matchingLabel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(10, 0, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        matchingTF,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(vsp, 2, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        recursiveCheckBox,
        new GridBagConstraints(
            2,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(vsp, 10, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        backupLabel,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(10, 0, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        backupTF,
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(vsp, 2, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        backupBttn,
        new GridBagConstraints(
            2,
            3,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(10, sp, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        templateLabel,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(10, 0, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        templateCh,
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(vsp, 2, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        sep1,
        new GridBagConstraints(
            0,
            5,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(10, 10, 10, 10),
            0,
            0));
    topLayout.setConstraints(
        staticVersioningLabel,
        new GridBagConstraints(
            0,
            6,
            1,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(10, 0, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        staticVersioningRadioButton,
        new GridBagConstraints(
            0,
            7,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(vsp, 10, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        staticVersioningPanel,
        new GridBagConstraints(
            0,
            8,
            GridBagConstraints.REMAINDER,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(vsp, 25, 10, 0),
            0,
            0));
    topLayout.setConstraints(
        dynamicVersioningRadioButton,
        new GridBagConstraints(
            0,
            9,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(vsp, 10, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        dynamicVersioningPanel,
        new GridBagConstraints(
            0,
            10,
            GridBagConstraints.REMAINDER,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(vsp, 25, 0, 0),
            0,
            0));
    topLayout.setConstraints(
        sep2,
        new GridBagConstraints(
            0,
            11,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(10, 10, 0, 10),
            0,
            0));

    invisibleBttn = new JButton();
    invisibleBttn.setVisible(false);
    topLayout.setConstraints(
        invisibleBttn,
        new GridBagConstraints(
            2,
            6,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.CENTER,
            new Insets(indent, sp, 0, 0),
            0,
            0));

    topPanel.add(dirLabel);
    topPanel.add(dirTF);
    topPanel.add(dirBttn);
    topPanel.add(matchingLabel);
    topPanel.add(matchingTF);
    topPanel.add(recursiveCheckBox);
    topPanel.add(backupLabel);
    topPanel.add(backupTF);
    topPanel.add(backupBttn);
    topPanel.add(templateLabel);
    topPanel.add(templateCh);
    topPanel.add(sep1);
    topPanel.add(staticVersioningLabel);
    topPanel.add(staticVersioningRadioButton);
    topPanel.add(staticVersioningPanel);
    topPanel.add(dynamicVersioningRadioButton);
    topPanel.add(dynamicVersioningPanel);
    topPanel.add(sep2);
    topPanel.add(invisibleBttn);

    //
    // Setup bottom panel
    //
    GridBagLayout buttomLayout = new GridBagLayout();
    JPanel buttomPanel = new JPanel();
    buttomPanel.setOpaque(false);
    buttomPanel.setLayout(buttomLayout);

    buttomLayout.setConstraints(
        runBttn,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(sp, 0, 0, 0),
            0,
            0));
    buttomPanel.add(runBttn);

    //
    // Setup main panel
    //
    GridBagLayout mainLayout = new GridBagLayout();
    JPanel mainPanel = new JPanel();

    mainPanel.setOpaque(false);
    mainPanel.setLayout(mainLayout);

    mainLayout.setConstraints(
        topPanel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(buf, buf, 0, buf),
            0,
            0));
    mainLayout.setConstraints(
        buttomPanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1,
            1,
            GridBagConstraints.SOUTH,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, buf, buf, buf),
            0,
            0));
    mainPanel.add(topPanel);
    mainPanel.add(buttomPanel);

    Border border = BorderFactory.createEtchedBorder();
    mainPanel.setBorder(border);

    GridBagLayout layout = new GridBagLayout();
    getContentPane().setLayout(layout);

    layout.setConstraints(
        mainPanel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    getContentPane().add(mainPanel);

    pack();
    setResizable(false);
  }
Ejemplo n.º 17
0
 public void decorateLargeRadioButton(JRadioButton box) {
   box.setIcon(largeRadio);
   box.setSelectedIcon(largeRadioChecked);
   box.setOpaque(false);
   box.setFocusPainted(false);
 }