예제 #1
0
  private JTextField createField(final String text) {
    final JTextField field =
        new JTextField(text) {
          public Dimension getPreferredSize() {
            Dimension preferredSize = super.getPreferredSize();
            return new Dimension(preferredSize.width, myTextHeight);
          }
        };
    field.setBackground(UIUtil.getPanelBackground());
    field.setEditable(false);
    final Border lineBorder = BorderFactory.createLineBorder(UIUtil.getPanelBackground());
    final DottedBorder dotted = new DottedBorder(UIUtil.getActiveTextColor());
    field.setBorder(lineBorder);
    // field.setFocusable(false);
    field.setHorizontalAlignment(JTextField.RIGHT);
    field.setCaretPosition(0);
    field.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent e) {
            field.setBorder(dotted);
          }

          public void focusLost(FocusEvent e) {
            field.setBorder(lineBorder);
          }
        });
    return field;
  }
  public SurrenderUI() {
    setType(Type.UTILITY);

    ExitB = new JButton("Exit");
    ExitB.setFont(new Font("Tahoma", Font.BOLD, 12));
    ExitB.setBackground(new Color(255, 215, 0));
    ExitB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
            new HSmain();
          }
        });
    ExitB.setBounds(461, 427, 296, 60);

    setTitle("Surrendering a Pet");
    Container pane = getContentPane();
    getContentPane().setLayout(null);
    pane.add(ExitB);

    txtSurrender = new JTextField();
    txtSurrender.setEditable(false);
    txtSurrender.setForeground(new Color(0, 0, 0));
    txtSurrender.setBackground(new Color(255, 215, 0));
    txtSurrender.setBounds(10, 11, 764, 50);
    txtSurrender.setHorizontalAlignment(SwingConstants.CENTER);
    txtSurrender.setFont(new Font("Lucida Handwriting", Font.BOLD, 18));
    txtSurrender.setText("Surrendering a Pet");
    getContentPane().add(txtSurrender);
    txtSurrender.setColumns(10);

    BackB = new JButton("Back");
    BackB.setFont(new Font("Tahoma", Font.BOLD, 12));
    BackB.setBackground(new Color(255, 215, 0));
    BackB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new AnimalServiceUI();
            dispose();
          }
        });
    BackB.setBounds(26, 427, 320, 60);
    getContentPane().add(BackB);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(0, 72, 764, 329);
    getContentPane().add(scrollPane);

    JTextPane txtSurrenderInfo = new JTextPane();
    scrollPane.setViewportView(txtSurrenderInfo);
    txtSurrenderInfo.setForeground(new Color(0, 0, 0));
    txtSurrenderInfo.setEditable(false);
    txtSurrenderInfo.setFont(new Font("Times New Roman", Font.BOLD, 15));
    txtSurrenderInfo.setText(
        "\tThe Humane Society of Lamar cannot accept every animal brought to our shelter immediately. \r\nWe respect the difficult decision of owners to relinquish their pets, and the hard choices of those \r\ngood citizens who are trying to help a stray. We accept the surrender of pets as space allows. \r\nWe maintain a waiting list for all animals needing to be admitted to the shelter.\r\nAnimals are surrendered to our facility by appointment.\r\nWe admit at least 12 animals per week. We accept more animals as adoptions and space allow.\r\nNote that we cannot accept aggressive, sick or pregnant animals.\r\nPlease call 409-225-7981, and one of our adoption specialists will speak to you.\r\nAt times our waiting list will have up to 100 animals waiting for admission and it can take several weeks \r\nbefore we can admit your pet.\r\nPlease understand that our primary goal is to place as many animals in forever homes as possible, \r\ntherefore we must give every pet admitted to the shelter enough time to find a loving home. \r\nWe cannot guarantee placement of every animal admitted to the shelter.\r\n\t\r\n\tAdmission of any animal into the Humane Society of Lamar  is based on the animal\u2019s health, \r\nbehavior, and adoptability. When you bring your pets, please have:\r\n\r\n    *Any veterinary records\r\n    *Your pet\u2019s medications\r\n    *Special food or treats that your pet needs\r\n    *Your pet\u2019s bed, toys, leash and other belongings from home\r\n\r\nA staff member will evaluate the temperament of your pet. Once your pet has been screened, \r\nand the Humane Society of Lamar decides to accept your pet, we ask a donation to our shelter to be made. \r\nThis is not required, but will greatly help us care for your pet.");

    setSize(800, 553);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
  private BindCardWithSidWindow() {

    int width = 230;
    int height = 190;

    setLayout(null);
    setBounds(
        (Utilities.getScreenWidth() - width) / 2,
        (Utilities.getScreenHeight() - height) / 2,
        width,
        height);
    setAlwaysOnTop(true);
    setResizable(false);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    JLabel cardPromptLbl = new JLabel("卡号:");
    cardPromptLbl.setFont(new Font("Courier New", 0, 15));
    cardPromptLbl.setBounds(30, 20, 50, 30);
    add(cardPromptLbl);

    JLabel sidPromptLbl = new JLabel("学号:");
    sidPromptLbl.setFont(new Font("Courier New", 0, 15));
    sidPromptLbl.setBounds(30, 50, 50, 30);
    add(sidPromptLbl);

    cardLbl = new JLabel("");
    cardLbl.setBackground(Color.blue);
    cardLbl.setFont(new Font("黑体", 0, 15));
    cardLbl.setHorizontalAlignment(JLabel.CENTER);
    cardLbl.setBounds(80, 20, 120, 30);
    add(cardLbl);

    sidField = new JTextField("");
    sidField.setHorizontalAlignment(JTextField.CENTER);
    sidField.setFont(new Font("黑体", 0, 15));
    sidField.setBounds(80, 50, 120, 30);
    add(sidField);

    confirmBtn = new JButton("确定");
    confirmBtn.setBounds(75, 100, 80, 40);
    confirmBtn.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {

            String text = sidField.getText();

            setVisible(false);

            if (text.length() != 0) {

              CardDatabase.bindCardWithStudent(cardLbl.getText(), text);
            }
          }
        });
    add(confirmBtn);
  }
예제 #4
0
  /**
   * Update the dialog contents.
   *
   * @param jheader The job portion of the dialog header.
   * @param job The queue job.
   * @param info The current job status information.
   */
  public void updateContents(
      String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) {
    ActionAgenda agenda = job.getActionAgenda();
    QueueJobResults results = info.getResults();

    String dir = "-";
    if ((agenda != null) && (info.getOsType() != null))
      dir = agenda.getTargetPath(info.getOsType()).toString();

    String hostname = "";
    if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]");

    String command = "-";
    if (details != null) command = details.getCommand();

    TreeMap<String, String> env = new TreeMap<String, String>();
    if (details != null) env = details.getEnvironment();

    setHeader("Execution Details -" + jheader + hostname);

    pWorkingDirField.setText(dir);

    BaseAction action = job.getAction();
    pCommandLineLabel.setText(
        "Action Command:  " + action.getName() + " (v" + action.getVersionID() + ")");
    pCommandLineArea.setText(command);

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

        if (!env.isEmpty()) {
          String last = env.lastKey();
          for (String key : env.keySet()) {
            String value = env.get(key);

            JTextField field =
                UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize);
            field.setHorizontalAlignment(JLabel.LEFT);

            if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
          }
        } else {
          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }
      }

      pEnvLabel.setText("Toolset Environment:  " + agenda.getToolset());
      pEnvScroll.setViewportView(comps[2]);
    }
  }
예제 #5
0
  // create and position GUI components; register event handlers
  private void createUserInterface() {
    // get content pane for attaching GUI components
    Container contentPane = getContentPane();

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

    // set up principalJLabel
    principalJLabel = new JLabel();
    principalJLabel.setBounds(20, 20, 80, 20);
    principalJLabel.setText("Principal:");
    contentPane.add(principalJLabel);

    // set up principalJTextField
    principalJTextField = new JTextField();
    principalJTextField.setBounds(80, 20, 90, 20);
    principalJTextField.setText("0");
    principalJTextField.setHorizontalAlignment(JTextField.RIGHT);
    contentPane.add(principalJTextField);

    // set up resultJLabel
    resultJLabel = new JLabel();
    resultJLabel.setBounds(20, 60, 100, 20);
    resultJLabel.setText("Result:");
    contentPane.add(resultJLabel);

    // set up resultJTextArea
    resultJTextArea = new JTextArea();
    resultJTextArea.setBounds(20, 85, 260, 120);
    resultJTextArea.setEditable(false);
    contentPane.add(resultJTextArea);

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

    // set properties of application's window
    setTitle("Comparing Rates"); // set title bar text
    setSize(310, 255); // set window size
    setVisible(true); // display window
  } // end method createUserInterface
예제 #6
0
  // constructor of TextFrame
  public TextFrame() {
    // this.message = message;
    message = "Click to Edit Text";
    messageFont = new Font("Arial", Font.PLAIN, 30);
    foreground = Color.black;
    background = Color.white;

    // custom dialog (it's a private class inside TextFrame)
    cd = new CustomDialog(this);

    messageField = new JTextField();
    messageField.setPreferredSize(new Dimension(300, 200));
    messageField.setEditable(false);
    messageField.setHorizontalAlignment(SwingConstants.CENTER);
    messageField.setAlignmentX(Component.CENTER_ALIGNMENT);
    updateMessage();

    customize = new JButton("Customize");
    customize.setMaximumSize(customize.getPreferredSize());
    customize.setAlignmentX(Component.CENTER_ALIGNMENT);

    apply = new JButton("Apply");
    apply.setMaximumSize(customize.getPreferredSize());
    apply.setAlignmentX(Component.CENTER_ALIGNMENT);

    /*add the listeners*/
    customize.addActionListener(this);
    apply.addActionListener(this);
    messageField.addMouseListener(new PopUpClass());

    // customize
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(customize);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(messageField);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(apply);
    p.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));

    // make panel this JFrame's content pane

    this.setContentPane(p);
  }
예제 #7
0
  public SierpinskiTriangle() {
    // Panel to hold label, text field, and a button
    JPanel panel = new JPanel();
    panel.add(new JLabel("Enter an order:"));
    panel.add(jtfOrder);
    jtfOrder.setHorizontalAlignment(SwingConstants.RIGHT);

    // Add a Sierpinski triangle panel to the applet
    add(trianglePanel);
    add(panel, BorderLayout.SOUTH);

    // Register a listener
    jtfOrder.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            trianglePanel.setOrder(Integer.parseInt(jtfOrder.getText()));
          }
        });
  }
예제 #8
0
  /** Constructor for allocating memory and simple initializing. */
  public GameBoard() {
    dealerPanel = new JPanel();
    playerPanel = new JPanel();
    controlPanel = new JPanel();
    money = new JLabel();
    record = new JLabel();
    inputImage = new JLabel(new ImageIcon("res/INPUT.gif"));
    moneyLabel = new JLabel(new ImageIcon("res/MONEY.gif"));
    betLabel = new JLabel(new ImageIcon("res/MAKE_YOUR_BET.gif"));
    recordLabel = new JLabel(new ImageIcon("res/BEST_SCORE.gif"));
    betButton = new JButton(new ImageIcon("res/BET.gif"));
    resultButton = new JButton(new ImageIcon("res/RESULT.gif"));
    betInput = new JTextField();

    try {
      recordReader = new BufferedReader(new FileReader("res/record"));
      bestScore = Integer.parseInt(recordReader.readLine());
      recordReader.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

    inputImage.setLayout(new BorderLayout());
    controlPanel.setLayout(new FlowLayout());

    betInput.setHorizontalAlignment(JTextField.CENTER);
    betButton.setBorder(BorderFactory.createEmptyBorder());
    betButton.setContentAreaFilled(false);
    resultButton.setBorder(BorderFactory.createEmptyBorder());
    resultButton.setContentAreaFilled(false);
    resultButton.setEnabled(false);
    betButton.addMouseListener(new BetListener());
    resultButton.addMouseListener(new ResultListener());
    betInput.setOpaque(false);
    betInput.setBorder(BorderFactory.createEmptyBorder());
    money.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    record.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    setOpaque(false);

    initGame();
    initRound();
  }
예제 #9
0
  public WalletSumPanel(BigInteger balance) {

    this.setBackground(Color.WHITE);
    double width = this.getSize().getWidth();
    this.setPreferredSize(new Dimension(500, 50));
    Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
    Border empty = new EmptyBorder(5, 8, 5, 8);
    CompoundBorder border = new CompoundBorder(line, empty);

    JLabel addressField = new JLabel();
    addressField.setPreferredSize(new Dimension(300, 35));
    this.add(addressField);

    JTextField amount = new JTextField();
    amount.setBorder(border);
    amount.setEnabled(true);
    amount.setEditable(false);
    amount.setText(Utils.getValueShortString(balance));

    amount.setPreferredSize(new Dimension(100, 35));
    amount.setForeground(new Color(143, 170, 220));
    amount.setHorizontalAlignment(SwingConstants.RIGHT);
    amount.setFont(new Font("Monospaced", 0, 13));
    amount.setBackground(Color.WHITE);
    this.add(amount);

    URL payoutIconURL = ClassLoader.getSystemResource("buttons/wallet-pay.png");
    ImageIcon payOutIcon = new ImageIcon(payoutIconURL);
    JLabel payOutLabel = new JLabel(payOutIcon);
    payOutLabel.setToolTipText("Payout for all address list");
    payOutLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    payOutLabel.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            JOptionPane.showMessageDialog(null, "Under construction");
          }
        });

    this.add(payOutLabel);
  }
예제 #10
0
  /** This method is called from within the constructor to initialize the form. */
  public void initComponents() {

    /** **************** The components ********************************* */
    firstPanel = new JPanel();
    firstPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 2));
    // If put to False: we see the container's background
    firstPanel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    firstPanel.setLayout(new GridLayout(4, 2, 3, 3));
    this.setLayout(new GridLayout(2, 1, 3, 3));
    this.add(firstPanel);

    proxyStackNameLabel = new JLabel("Proxy stack name:");
    proxyStackNameLabel.setToolTipText("The name of the stack to set");
    // Alignment of the text
    proxyStackNameLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    proxyStackNameLabel.setForeground(Color.black);
    // Size of the text
    proxyStackNameLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    proxyStackNameLabel.setOpaque(true);
    proxyStackNameLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    proxyStackNameLabel.setBorder(ProxyLauncher.labelBorder);
    proxyStackNameTextField = new JTextField(20);
    proxyStackNameTextField.setHorizontalAlignment(AbstractButton.CENTER);
    proxyStackNameTextField.setFont(new Font("Dialog", 0, 14));
    proxyStackNameTextField.setBackground(ProxyLauncher.textBackGroundColor);
    proxyStackNameTextField.setForeground(Color.black);
    proxyStackNameTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(proxyStackNameLabel);
    firstPanel.add(proxyStackNameTextField);

    proxyIPAddressLabel = new JLabel("Proxy IP address:");
    proxyIPAddressLabel.setToolTipText("The address of the proxy to set");
    // Alignment of the text
    proxyIPAddressLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    proxyIPAddressLabel.setForeground(Color.black);
    // Size of the text
    proxyIPAddressLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    proxyIPAddressLabel.setOpaque(true);
    proxyIPAddressLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    proxyIPAddressLabel.setBorder(ProxyLauncher.labelBorder);
    proxyIPAddressTextField = new JTextField(20);
    proxyIPAddressTextField.setHorizontalAlignment(AbstractButton.CENTER);
    proxyIPAddressTextField.setFont(new Font("Dialog", 0, 14));
    proxyIPAddressTextField.setBackground(ProxyLauncher.textBackGroundColor);
    proxyIPAddressTextField.setForeground(Color.black);
    proxyIPAddressTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(proxyIPAddressLabel);
    firstPanel.add(proxyIPAddressTextField);

    outboundProxyLabel = new JLabel("Next hop (IP:port/protocol):");
    outboundProxyLabel.setToolTipText(
        "Location where the message will be sent "
            + "if all the resolutions (DNS, router,...) fail. If not set: 404 will be replied");
    // Alignment of the text
    outboundProxyLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    outboundProxyLabel.setForeground(Color.black);
    // Size of the text
    outboundProxyLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    outboundProxyLabel.setOpaque(true);
    outboundProxyLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    outboundProxyLabel.setBorder(ProxyLauncher.labelBorder);
    outboundProxyTextField = new JTextField(20);
    outboundProxyTextField.setHorizontalAlignment(AbstractButton.CENTER);
    outboundProxyTextField.setFont(new Font("Dialog", 0, 14));
    outboundProxyTextField.setBackground(ProxyLauncher.textBackGroundColor);
    outboundProxyTextField.setForeground(Color.black);
    outboundProxyTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(outboundProxyLabel);
    firstPanel.add(outboundProxyTextField);

    routerClassLabel = new JLabel("The Router class name:");
    routerClassLabel.setToolTipText(
        "The class name (full java package name) of the router" + " used to forward the messages");
    // Alignment of the text
    routerClassLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    routerClassLabel.setForeground(Color.black);
    // Size of the text
    routerClassLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    routerClassLabel.setOpaque(true);
    routerClassLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    routerClassLabel.setBorder(ProxyLauncher.labelBorder);
    routerClassTextField = new JTextField(20);
    routerClassTextField.setHorizontalAlignment(AbstractButton.CENTER);
    routerClassTextField.setFont(new Font("Dialog", 0, 12));
    routerClassTextField.setBackground(ProxyLauncher.textBackGroundColor);
    routerClassTextField.setForeground(Color.black);
    routerClassTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(routerClassLabel);
    firstPanel.add(routerClassTextField);

    JPanel panel = new JPanel();
    // top, left, bottom, right
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 2));
    // If put to False: we see the container's background
    panel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    panel.setLayout(new BorderLayout());
    this.add(panel);

    JLabel lpLabel = new JLabel("Listening points list:");
    lpLabel.setVisible(true);
    lpLabel.setToolTipText("The listening points of the proxy");
    lpLabel.setHorizontalAlignment(AbstractButton.CENTER);
    lpLabel.setForeground(Color.black);
    lpLabel.setFont(new Font("Dialog", 1, 12));
    lpLabel.setOpaque(true);
    lpLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    lpLabel.setBorder(ProxyLauncher.labelBorder);
    panel.add(lpLabel, BorderLayout.NORTH);

    // this.add(listeningPointsList);
    JScrollPane scrollPane =
        new JScrollPane(
            listeningPointsList,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.add(scrollPane, BorderLayout.CENTER);

    thirdPanel = new JPanel();
    thirdPanel.setOpaque(false);
    // top, left, bottom, right
    thirdPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 5, 0));
    thirdPanel.setLayout(new GridLayout(1, 2, 3, 3));

    JButton addLPButton = new JButton(" Add ");
    addLPButton.setToolTipText("Add a listening point");
    addLPButton.setFocusPainted(false);
    addLPButton.setFont(new Font("Dialog", 1, 16));
    addLPButton.setBackground(ProxyLauncher.buttonBackGroundColor);
    addLPButton.setBorder(ProxyLauncher.buttonBorder);
    addLPButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            addLPButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(addLPButton);

    JButton removeLPButton = new JButton(" Remove ");
    removeLPButton.setToolTipText("Remove a listening point");
    removeLPButton.setFocusPainted(false);
    removeLPButton.setFont(new Font("Dialog", 1, 16));
    removeLPButton.setBackground(ProxyLauncher.buttonBackGroundColor);
    removeLPButton.setBorder(ProxyLauncher.buttonBorder);
    removeLPButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            removeLPButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(removeLPButton);

    panel.add(thirdPanel, BorderLayout.SOUTH);
  }
  // create and position GUI components; register event handlers
  private void createUserInterface() {
    // get content pane for attaching GUI components
    Container contentPane = getContentPane();

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

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

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

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

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

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

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

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

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

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

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

    // set properties of application's window
    setTitle("Interest Calculator"); // set title bar text
    setSize(340, 296); // set window size
    setVisible(true); // display window
  } // end method createUserInterface
예제 #12
0
 /** The constructor sets up the listeners to update values appropriately. */
 Row() {
   hoursTF.addCaretListener(ReviewDialog.this);
   hoursTF.setHorizontalAlignment(SwingConstants.RIGHT);
 }
예제 #13
0
  public PanelMore(OSeaMAction dia) {
    dlg = dia;
    setLayout(null);
    panelPat = new PanelPat(dlg, Ent.BODY);
    panelPat.setBounds(new Rectangle(0, 0, 110, 160));
    add(panelPat);
    add(getRegionButton(regionAButton, 110, 0, 34, 30, "RegionA"));
    add(getRegionButton(regionBButton, 110, 32, 34, 30, "RegionB"));
    add(getRegionButton(regionCButton, 110, 64, 34, 30, "RegionC"));

    elevLabel = new JLabel(Messages.getString("Elevation"), SwingConstants.CENTER);
    elevLabel.setBounds(new Rectangle(140, 0, 90, 20));
    add(elevLabel);
    elevBox = new JTextField();
    elevBox.setBounds(new Rectangle(160, 20, 50, 20));
    elevBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(elevBox);
    elevBox.addFocusListener(flElev);

    heightLabel = new JLabel(Messages.getString("Height"), SwingConstants.CENTER);
    heightLabel.setBounds(new Rectangle(140, 40, 90, 20));
    add(heightLabel);
    heightBox = new JTextField();
    heightBox.setBounds(new Rectangle(160, 60, 50, 20));
    heightBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(heightBox);
    heightBox.addFocusListener(flHeight);

    sourceLabel = new JLabel(Messages.getString("Source"), SwingConstants.CENTER);
    sourceLabel.setBounds(new Rectangle(110, 80, 130, 20));
    add(sourceLabel);
    sourceBox = new JTextField();
    sourceBox.setBounds(new Rectangle(110, 100, 130, 20));
    sourceBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(sourceBox);
    sourceBox.addFocusListener(flSource);

    infoLabel = new JLabel(Messages.getString("Information"), SwingConstants.CENTER);
    infoLabel.setBounds(new Rectangle(110, 120, 130, 20));
    add(infoLabel);
    infoBox = new JTextField();
    infoBox.setBounds(new Rectangle(110, 140, 130, 20));
    infoBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(infoBox);
    infoBox.addFocusListener(flInfo);

    statusLabel = new JLabel(Messages.getString("Status"), SwingConstants.CENTER);
    statusLabel.setBounds(new Rectangle(250, 0, 100, 20));
    add(statusLabel);
    statusBox = new JComboBox();
    statusBox.setBounds(new Rectangle(250, 20, 100, 20));
    addStsItem("", Sts.UNKSTS);
    addStsItem(Messages.getString("Permanent"), Sts.PERM);
    addStsItem(Messages.getString("Occasional"), Sts.OCC);
    addStsItem(Messages.getString("Recommended"), Sts.REC);
    addStsItem(Messages.getString("NotInUse"), Sts.NIU);
    addStsItem(Messages.getString("Intermittent"), Sts.INT);
    addStsItem(Messages.getString("Reserved"), Sts.RESV);
    addStsItem(Messages.getString("Temporary"), Sts.TEMP);
    addStsItem(Messages.getString("Private"), Sts.PRIV);
    addStsItem(Messages.getString("Mandatory"), Sts.MAND);
    addStsItem(Messages.getString("Destroyed"), Sts.DEST);
    addStsItem(Messages.getString("Extinguished"), Sts.EXT);
    addStsItem(Messages.getString("Illuminated"), Sts.ILLUM);
    addStsItem(Messages.getString("Historic"), Sts.HIST);
    addStsItem(Messages.getString("Public"), Sts.PUB);
    addStsItem(Messages.getString("Synchronized"), Sts.SYNC);
    addStsItem(Messages.getString("Watched"), Sts.WATCH);
    addStsItem(Messages.getString("UnWatched"), Sts.UNWAT);
    addStsItem(Messages.getString("Doubtful"), Sts.DOUBT);
    add(statusBox);
    statusBox.addActionListener(alStatus);

    constrLabel = new JLabel(Messages.getString("Construction"), SwingConstants.CENTER);
    constrLabel.setBounds(new Rectangle(250, 40, 100, 20));
    add(constrLabel);
    constrBox = new JComboBox();
    constrBox.setBounds(new Rectangle(250, 60, 100, 20));
    addCnsItem("", Cns.UNKCNS);
    addCnsItem(Messages.getString("Masonry"), Cns.BRICK);
    addCnsItem(Messages.getString("Concreted"), Cns.CONC);
    addCnsItem(Messages.getString("Boulders"), Cns.BOULD);
    addCnsItem(Messages.getString("HardSurfaced"), Cns.HSURF);
    addCnsItem(Messages.getString("Unsurfaced"), Cns.USURF);
    addCnsItem(Messages.getString("Wooden"), Cns.WOOD);
    addCnsItem(Messages.getString("Metal"), Cns.METAL);
    addCnsItem(Messages.getString("GRP"), Cns.GLAS);
    addCnsItem(Messages.getString("Painted"), Cns.PAINT);
    add(constrBox);
    constrBox.addActionListener(alConstr);

    conLabel = new JLabel(Messages.getString("Conspicuity"), SwingConstants.CENTER);
    conLabel.setBounds(new Rectangle(250, 80, 100, 20));
    add(conLabel);
    conBox = new JComboBox();
    conBox.setBounds(new Rectangle(250, 100, 100, 20));
    addConItem("", Con.UNKCON);
    addConItem(Messages.getString("Conspicuous"), Con.CONSP);
    addConItem(Messages.getString("NotConspicuous"), Con.NCONS);
    add(conBox);
    conBox.addActionListener(alCon);

    reflLabel = new JLabel(Messages.getString("Reflectivity"), SwingConstants.CENTER);
    reflLabel.setBounds(new Rectangle(250, 120, 100, 20));
    add(reflLabel);
    reflBox = new JComboBox();
    reflBox.setBounds(new Rectangle(250, 140, 100, 20));
    addReflItem("", Con.UNKCON);
    addReflItem(Messages.getString("Conspicuous"), Con.CONSP);
    addReflItem(Messages.getString("NotConspicuous"), Con.NCONS);
    addReflItem(Messages.getString("Reflector"), Con.REFL);
    add(reflBox);
    reflBox.addActionListener(alRefl);
  }
예제 #14
0
  public void jbInit() throws Exception {
    this.setLayout(null);
    fContractPriceTextField.setFont(new java.awt.Font("Dialog", 1, 11));
    fContractPriceTextField.setDisabledTextColor(Color.black);
    fContractPriceTextField.setEditable(false);
    fContractPriceTextField.setHorizontalAlignment(SwingConstants.RIGHT);
    fContractPriceTextField.setBounds(new java.awt.Rectangle(285, 182, 55, 21));
    fContractVolumeTextField.setFont(new java.awt.Font("Dialog", 1, 11));
    fContractVolumeTextField.setDisabledTextColor(Color.black);
    fContractVolumeTextField.setEditable(false);
    fContractVolumeTextField.setHorizontalAlignment(SwingConstants.RIGHT);
    fContractVolumeTextField.setBounds(new java.awt.Rectangle(285, 238, 55, 21));
    fContractVolumeLabel.setText(fRb.getString("CONTRACT_VOLUME"));
    fContractVolumeLabel.setForeground(Color.black);
    fContractVolumeLabel.setBounds(new java.awt.Rectangle(272, 218, 99, 17));
    fContractPriceLabel.setBounds(new java.awt.Rectangle(272, 160, 92, 17));
    fContractPriceLabel.setText(fRb.getString("CONTRACT_PRICE"));
    fContractPriceLabel.setForeground(Color.black);

    fBoardGraph.setLayout(borderLayout1);
    fDay.setBounds(new java.awt.Rectangle(337, 87, 42, 21));
    fDayLabel.setText(fRb.getString("DAY") + ":");
    fDayLabel.setForeground(Color.black);
    fDayLabel.setBounds(new java.awt.Rectangle(267, 89, 67, 17));
    fBoardLabel.setText(fRb.getString("SESSION") + ":");
    fBoardLabel.setForeground(Color.black);
    fBoardLabel.setBounds(new java.awt.Rectangle(267, 121, 68, 17));
    fBoard.setBounds(new java.awt.Rectangle(337, 119, 42, 22));
    fPreviousBoardLabel.setFont(new java.awt.Font("Dialog", 1, 12));
    fPreviousBoardLabel.setText(fRb.getString("PREVIOUS_PRICING"));
    fPreviousBoardLabel.setForeground(Color.black);
    fPreviousBoardLabel.setBounds(new java.awt.Rectangle(85, 4, 99, 17));
    fXYToggleButton.setBorder(BorderFactory.createRaisedBevelBorder());
    fXYToggleButton.setText("Exchange X-Y");
    fXYToggleButton.setBounds(new java.awt.Rectangle(268, 43, 114, 25));
    fXYToggleButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fIsExchangeXY = fXYToggleButton.isSelected();
            fIsUpdated = true;
            gUpdate();
          }
        });

    this.setBorder(BorderFactory.createEtchedBorder());
    this.setBounds(new java.awt.Rectangle(325, 7, 387, 283));
    this.setLayout(null);
    fBoardGraph.setBorder(BorderFactory.createEtchedBorder());
    fBoardGraph.setBounds(new java.awt.Rectangle(5, 26, 257, 243));
    fBoardGraph.getGraph().add(new UGraphData(fSellName, fSellColor));
    fBoardGraph.getGraph().add(new UGraphData(fBuyName, fBuyColor));
    fBoardGraph.setLeftMargin(60);
    this.add(fBoardGraph, null);
    this.add(fContractVolumeTextField, null);
    this.add(fContractVolumeLabel, null);
    this.add(fContractPriceTextField, null);
    this.add(fContractPriceLabel, null);
    this.add(fBoardLabel, null);
    this.add(fDayLabel, null);
    this.add(fXYToggleButton, null);
    this.add(fPreviousBoardLabel, null);
    this.add(fDay, null);
    this.add(fBoard, null);
    fBoardGraph.setBackground(Color.white);
    fBoardGraph.setNumOfHorizontalLine(0);
    fBoardGraph.setNumOfVerticalLine(0);
    fBoardGraph.setFixedMaxX(1);
    fBoardGraph.setFixedMinX(0);
    fBoardGraph.setFixedMaxY(1);
    fBoardGraph.setFixedMinY(0);
    addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent ce) {
            gUpdate();
          }
        });
  }
예제 #15
0
 /**
  * Component initialization.
  *
  * @throws java.lang.Exception
  */
 private void jbInit() throws Exception {
   contentPane = (JPanel) getContentPane();
   contentPane.setLayout(xYLayoutServer);
   setSize(new Dimension(365, 327));
   setTitle("ProgDan® Codename Avalon: Parser Server v. 0.1");
   statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
   statusBar.setText("Server stopped!");
   jPanelFiles.setBorder(BorderFactory.createEtchedBorder());
   jPanelFiles.setToolTipText("");
   jPanelFiles.setLayout(xYLayout1);
   jLabelFiles.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
   jLabelFiles.setText("Files received:");
   jLabelConverted.setText("Files converted:");
   jProgressBarConvert.setMaximum(0);
   jProgressBarConvert.setString("0");
   jProgressBarConvert.setStringPainted(true);
   jLabelNoConvert.setText("Files not converted:");
   jProgressBarNoConvert.setMaximum(0);
   jProgressBarNoConvert.setString("0");
   jProgressBarNoConvert.setStringPainted(true);
   jProgressBarNoConvert.addPropertyChangeListener(
       new FrameServer_jProgressBarNoConvert_propertyChangeAdapter(this));
   jButtonStart.setSelected(false);
   jButtonStart.setText("Start");
   jButtonStart.addActionListener(new FrameServer_jButtonStart_actionAdapter(this));
   jButtonStop.setEnabled(false);
   jButtonStop.setText("Stop");
   jButtonStop.addActionListener(new FrameServer_jButtonStop_actionAdapter(this));
   jButtonExit.setText("Exit");
   jButtonExit.addActionListener(new FrameServer_jButtonExit_actionAdapter(this));
   jButtonConfig.setText("Config");
   jButtonConfig.addActionListener(new FrameServer_jButtonConfig_actionAdapter(this));
   jLabelActiveConnections.setText("Active Connections:");
   jTextFieldConnections.setEditable(false);
   jTextFieldConnections.setText("0");
   jTextFieldConnections.setHorizontalAlignment(SwingConstants.CENTER);
   jProgressBarFiles.setMaximum(0);
   jProgressBarFiles.setString("0");
   jProgressBarFiles.setStringPainted(true);
   jButtonText.setEnabled(false);
   jButtonText.setText("...");
   jButtonText.addActionListener(new FrameServer_jButtonText_actionAdapter(this));
   jPanelLogo.setBorder(null);
   jPanelLogo.setMinimumSize(new Dimension(10, 10));
   jPanelLogo.setPreferredSize(new Dimension(10, 10));
   jPanelLogo.setLayout(null);
   jLabelTitle.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
   jLabelTitle.setText("ProgDan® Codename Avalon");
   jLabelApplication.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
   jLabelApplication.setForeground(Color.red);
   jLabelApplication.setText("Parser Server");
   jLabelRelease.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
   jLabelRelease.setForeground(Color.red);
   jLabelRelease.setText("Release 0.1 - Beta");
   jLabelCopyright.setText("Copyright 2004-2005 - ProgDan® Software");
   jPanelFiles.add(jLabelFiles, new XYConstraints(8, 5, -1, -1));
   jPanelFiles.add(jLabelNoConvert, new XYConstraints(8, 50, -1, -1));
   jPanelFiles.add(jLabelConverted, new XYConstraints(8, 28, -1, -1));
   jPanelFiles.add(jProgressBarFiles, new XYConstraints(108, 3, 160, -1));
   jPanelFiles.add(jProgressBarConvert, new XYConstraints(108, 26, 160, -1));
   jPanelFiles.add(jProgressBarNoConvert, new XYConstraints(108, 48, 160, -1));
   jPanelFiles.add(jButtonText, new XYConstraints(279, 46, -1, -1));
   contentPane.add(jTextFieldConnections, new XYConstraints(158, 118, 131, -1));
   contentPane.add(jLabelActiveConnections, new XYConstraints(45, 121, -1, -1));
   contentPane.add(jButtonExit, new XYConstraints(277, 238, 65, -1));
   contentPane.add(jButtonStart, new XYConstraints(11, 238, 65, -1));
   contentPane.add(jButtonStop, new XYConstraints(100, 238, 65, -1));
   contentPane.add(jButtonConfig, new XYConstraints(188, 238, 65, -1));
   contentPane.add(statusBar, new XYConstraints(6, 272, 344, -1));
   contentPane.add(jPanelFiles, new XYConstraints(13, 148, 327, 77));
   contentPane.add(jPanelLogo, new XYConstraints(13, 15, 112, 96));
   contentPane.add(jLabelTitle, new XYConstraints(141, 14, -1, -1));
   contentPane.add(jLabelApplication, new XYConstraints(165, 40, -1, -1));
   contentPane.add(jLabelRelease, new XYConstraints(250, 66, -1, -1));
   contentPane.add(jLabelCopyright, new XYConstraints(137, 95, -1, -1));
 }
예제 #16
0
파일: PlusMinus.java 프로젝트: sha8e/purdue
 public void createTextField() {
   text = new JTextField("0", 10); // A textfield object 10 columns wide is created.
   // Initially it contains the string 0
   // indicating that the button has not been clicked.
   text.setHorizontalAlignment(JTextField.CENTER);
 }
  // Constructor connection receiving a socket number
  public ClientGUI(String host, int port, int udpPort) {

    super("Clash of Clans");
    defaultPort = port;
    defaultUDPPort = udpPort;
    defaultHost = host;

    // the server name and the port number
    JPanel serverAndPort = new JPanel(new GridLayout(1, 5, 1, 3));
    tfServer = new JTextField(host);
    tfPort = new JTextField("" + port);
    tfPort.setHorizontalAlignment(SwingConstants.RIGHT);

    // CHAT COMPONENTS
    chatStatus = new JLabel("Please login first", SwingConstants.LEFT);
    chatField = new JTextField(18);
    chatField.setBackground(Color.WHITE);

    JPanel chatControls = new JPanel();
    chatControls.add(chatStatus);
    chatControls.add(chatField);
    chatControls.setBounds(0, 0, 200, 50);

    chatArea = new JTextArea("Welcome to the Chat room\n", 80, 80);
    chatArea.setEditable(false);
    JScrollPane jsp = new JScrollPane(chatArea);
    jsp.setBounds(0, 50, 200, 550);

    JPanel chatPanel = new JPanel(null);
    chatPanel.setSize(1000, 600);
    chatPanel.add(chatControls);
    chatPanel.add(jsp);

    // LOGIN COMPONENTS
    mainLogin = new MainPanel();
    mainLogin.add(new JLabel("Main Login"));

    usernameField = new JTextField("user", 15);
    passwordField = new JTextField("password", 15);
    login = new CButton("Login");
    login.addActionListener(this);

    sideLogin = new SidePanel(new FlowLayout(FlowLayout.LEFT));
    sideLogin.add(usernameField);
    sideLogin.add(passwordField);
    sideLogin.add(login);

    // MAIN MENU COMPONENTS
    mainMenu = new MainPanel();
    mmLabel = new JLabel("Main Menu");
    timer = new javax.swing.Timer(1000, this);
    mainMenu.add(mmLabel);

    sideMenu = new SidePanel(new FlowLayout(FlowLayout.LEFT));
    cmButton = new CButton("Customize Map");
    tmButton = new CButton("Troop Movement");
    gsButton = new CButton("Game Start");
    logout = new CButton("Logout");
    cmButton.addActionListener(this);
    tmButton.addActionListener(this);
    gsButton.addActionListener(this);
    logout.addActionListener(this);
    sideMenu.add(cmButton);
    // sideMenu.add(tmButton);
    sideMenu.add(gsButton);
    sideMenu.add(logout);

    // CM COMPONENTS
    mainCM = new MainPanel(new GridLayout(mapSize, mapSize));
    tiles = new Tile[mapSize][mapSize];
    int tileSize = mainCM.getWidth() / mapSize;
    for (int i = 0; i < mapSize; i++) {
      tiles[i] = new Tile[mapSize];
      for (int j = 0; j < mapSize; j++) {
        tiles[i][j] = new Tile(i, j);
        tiles[i][j].setPreferredSize(new Dimension(tileSize, tileSize));
        tiles[i][j].setSize(tileSize, tileSize);
        tiles[i][j].addActionListener(this);

        if ((i + j) % 2 == 0) tiles[i][j].setBackground(new Color(102, 255, 51));
        else tiles[i][j].setBackground(new Color(51, 204, 51));

        mainCM.add(tiles[i][j]);
      }
    }

    sideCM = new SidePanel(new FlowLayout(FlowLayout.LEFT));
    cmBack = new CButton("Main Menu");
    cmBack.setSize(150, 30);
    cmBack.setPreferredSize(new Dimension(150, 30));
    cmBack.addActionListener(this);
    sideCM.add(cmBack);

    // TM COMPONENTS
    mainTM = new MainPanel(null);
    mapTM = new Map(600);
    mapTM.setPreferredSize(new Dimension(600, 600));
    mapTM.setSize(600, 600);
    mapTM.setBounds(0, 0, 600, 600);
    mainTM.add(mapTM);

    sideTM = new SidePanel(new FlowLayout(FlowLayout.LEFT));
    tmBack = new CButton("Main Menu");
    tmBack.setSize(150, 30);
    tmBack.setPreferredSize(new Dimension(150, 30));
    tmBack.addActionListener(this);
    sideTM.add(tmBack);

    JRadioButton button;
    ButtonGroup group;

    ub = new ArrayList<JRadioButton>();
    group = new ButtonGroup();

    button = new JRadioButton("Barbarian");
    button.addActionListener(this);
    ub.add(button);
    sideTM.add(button);
    group.add(button);

    button = new JRadioButton("Archer");
    button.addActionListener(this);
    ub.add(button);
    sideTM.add(button);
    group.add(button);

    createBuildings();
    bb = new ArrayList<JRadioButton>();

    group = new ButtonGroup();

    JRadioButton removeButton = new JRadioButton("Remove Building");
    bb.add(removeButton);
    sideCM.add(removeButton);
    group.add(removeButton);

    for (int i = 0; i < bList.size(); i++) {
      button = new JRadioButton(bList.get(i).getName() + '-' + bList.get(i).getQuantity());
      bb.add(button);
      sideCM.add(button);
      group.add(button);
    }

    mainPanels = new MainPanel(new CardLayout());
    mainPanels.add(mainLogin, "Login");
    mainPanels.add(mainMenu, "Menu");
    mainPanels.add(mainCM, "CM");
    mainPanels.add(mainTM, "TM");

    sidePanels = new SidePanel(new CardLayout());
    sidePanels.add(sideLogin, "Login");
    sidePanels.add(sideMenu, "Menu");
    sidePanels.add(sideCM, "CM");
    sidePanels.add(sideTM, "TM");

    JPanel mainPanel = new JPanel(null);
    mainPanel.setSize(1000, 600);
    mainPanel.add(sidePanels);
    mainPanel.add(mainPanels);
    mainPanel.add(chatPanel);

    add(mainPanel, BorderLayout.CENTER);

    try {
      setIconImage(ImageIO.read(new File("images/logo.png")));
    } catch (IOException exc) {
      exc.printStackTrace();
    }

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(1000, 600);
    setVisible(true);
    setResizable(false);
    chatField.requestFocus();
  }
예제 #18
0
 public void setHorizontalAlignment(int h) {
   textField.setHorizontalAlignment(h);
 }
예제 #19
0
  GamePanel() {
    MODEL = new Model();

    // Set JLabel messages from MODEL & center align
    problem = new JLabel(MODEL.prb);
    score = new JLabel(MODEL.str);
    msg = new JLabel(MODEL.msg);
    timeLab = new JLabel(MODEL.time);
    problem.setHorizontalAlignment(JLabel.CENTER);
    score.setHorizontalAlignment(JLabel.CENTER);
    msg.setHorizontalAlignment(JLabel.CENTER);
    timeLab.setHorizontalAlignment(JLabel.CENTER);

    // create area where user types in answer
    answerPrompt = new JLabel("Answer: ");
    answerPrompt.setHorizontalAlignment(JLabel.RIGHT);
    entry = new JTextField("Type...");
    entry.setSelectionStart(0);
    entry.setSelectionEnd(7);
    entry.setHorizontalAlignment(JTextField.CENTER);
    clear = new JButton("Clear");

    // answer area contained in an HBox
    JPanel HBox = new JPanel();
    HBox.setLayout(new GridLayout(1, 3));
    HBox.add(answerPrompt);
    HBox.add(entry);
    HBox.add(clear);
    HBox.setDoubleBuffered(true);

    // Timer
    MODEL.timer =
        new Timer(
            1000,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Update("time");
              }
            });

    // Entire Game Area in VBox (messages & answer area)
    JPanel VBox = new JPanel();
    VBox.setLayout(new GridLayout(5, 1));
    VBox.setDoubleBuffered(true);
    VBox.add(problem);
    VBox.add(HBox);
    VBox.add(score);
    VBox.add(msg);
    VBox.add(timeLab);

    // Create KeyPad
    JPanel ButtonPanel = new JPanel();
    ButtonPanel.setLayout(new GridLayout(4, 3));
    ButtonPanel.setDoubleBuffered(true);

    buttons = new JButton[10];
    for (int i = 1; i < buttons.length; i++) {
      buttons[i] = new JButton(Integer.toString(i));
      ButtonPanel.add(buttons[i]);
    }
    JLabel filler = new JLabel(" ");
    ButtonPanel.add(filler);
    buttons[0] = new JButton("0");
    ButtonPanel.add(buttons[0]);

    // put everything together
    add(VBox);
    add(ButtonPanel);
  } // end of GamePanel() constructor
예제 #20
0
파일: Mart.java 프로젝트: Camtendo/jokemon
  // Sets up the window
  private void setUpGui() {
    this.setTitle("Mart");
    this.setSize(300, 550);
    this.setResizable(false);
    this.setLayout(null);
    URL iconU = Mart.class.getResource("icon.png");
    Image icon = Toolkit.getDefaultToolkit().getImage(iconU);
    this.setIconImage(icon);
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.setVisible(false);
    this.setLocationRelativeTo(null);

    Container cp = this.getContentPane();

    int x = 16;
    int y = 35;
    for (int i = 0; i < pockets.length; i++) {
      String messager = "";
      switch (i) {
        case 0:
          messager = "Items";
          break;
        case 1:
          messager = "Medicine";
          break;
        case 2:
          messager = "Pokeballs";
          break;
        case 3:
          messager = "TMs/HMs";
          break;
        case 4:
          messager = "Battle Items";
          break;
        case 5:
          messager = "Key Items";
          break;
      }
      pockets[i] = new JButton(messager);
      pockets[i].setBounds(x, y, 120, 20);
      pockets[i].addActionListener(this);
      pockets[i].setVisible(false);
      cp.add(pockets[i]);
      x += 140;
      if (x > this.getWidth() - 120) {
        x = 16;
        y += 30;
      }
    }

    amountDisplay = new JLabel("Amount: ");
    amountDisplay.setHorizontalAlignment(JLabel.LEFT);
    amountDisplay.setBounds(36, 150, 130, 20);
    amountDisplay.setVisible(false);
    cp.add(amountDisplay);

    totalAmount = new JLabel("Enter Amount");
    totalAmount.setHorizontalAlignment(JLabel.CENTER);
    totalAmount.setBounds(16, 180, 260, 20);
    totalAmount.setVisible(false);
    cp.add(totalAmount);

    amountField = new JTextField();
    amountField.setHorizontalAlignment(JLabel.CENTER);
    amountField.setBounds(96, 150, 180, 20);
    amountField.setVisible(false);
    amountField.addActionListener(this);
    cp.add(amountField);

    buyButton = new JButton("Buy Amount");
    buyButton.addActionListener(this);
    buyButton.setBounds(16, 210, 260, 20);
    buyButton.setVisible(false);
    buyButton.setEnabled(false);
    cp.add(buyButton);

    sellButton = new JButton("Sell Amount");
    sellButton.addActionListener(this);
    sellButton.setBounds(16, 210, 260, 20);
    sellButton.setVisible(false);
    sellButton.setEnabled(false);
    cp.add(sellButton);

    buySellButton = new JButton("Buying");
    buySellButton.setVisible(false);
    buySellButton.addActionListener(this);
    buySellButton.setBounds(16, 5, 260, 20);
    cp.add(buySellButton);

    y = 125;
    for (int i = 0; i < display.length; i++) {
      display[i] = new JButton();
      display[i].setHorizontalAlignment(JLabel.LEFT);
      display[i].addActionListener(this);
      display[i].setBounds(15, y, 260, 20);
      display[i].setVisible(false);
      y += 25;
      cp.add(display[i]);
    }

    x = 16;
    y = this.getHeight() - 120;
    for (int i = 0; i < pages.length; i++) {
      pages[i] = new JButton("Page " + (i + 1));
      pages[i].setBounds(x, y, 80, 20);
      pages[i].addActionListener(this);
      pages[i].setVisible(false);
      cp.add(pages[i]);
      x += 90;
      if (x > this.getWidth() - 20) {
        x = 16;
        y += 30;
      }
    }

    x = 16;
    y = this.getHeight() - 180;
    moneyDisplay = new JLabel("Money: $" + Inventory.money);
    moneyDisplay.setVisible(false);
    moneyDisplay.setHorizontalAlignment(JLabel.CENTER);
    moneyDisplay.setBounds(x, y, 260, 20);
    cp.add(moneyDisplay);

    information = new JButton("Information");
    information.setBounds(16, this.getHeight() - 150, 260, 20);
    information.addActionListener(this);
    information.setVisible(false);
    cp.add(information);

    closeButton = new JButton("Close Window");
    closeButton.setBounds(16, this.getHeight() - 60, 260, 20);
    closeButton.addActionListener(this);
    closeButton.setVisible(false);
    cp.add(closeButton);

    visible = false;
  }
예제 #21
0
  private void setupUI() {
    JPanel batchInputPanel = new JPanel();
    batchInputPanel.setLayout(new GridLayoutManager(7, 2, new Insets(0, 0, 0, 0), -1, -1));
    batchInputPanel.setEnabled(true);
    this.add(
        batchInputPanel,
        new GridConstraints(
            2,
            0,
            1,
            1,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_BOTH,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            null,
            null,
            null,
            0,
            false));
    batchInputPanel.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
    final Spacer spacer3 = new Spacer();
    batchInputPanel.add(
        spacer3,
        new GridConstraints(
            6,
            0,
            1,
            1,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_VERTICAL,
            1,
            GridConstraints.SIZEPOLICY_WANT_GROW,
            null,
            new Dimension(195, 14),
            null,
            0,
            false));
    dpiXLabel = new JLabel("DPI X: ");
    batchInputPanel.add(
        dpiXLabel,
        new GridConstraints(
            2,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(195, 16),
            null,
            0,
            false));
    dpiYLabel = new JLabel("DPI Y: ");
    batchInputPanel.add(
        dpiYLabel,
        new GridConstraints(
            3,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(195, 16),
            null,
            0,
            false));
    startDepthLabel = new JLabel("Start Depth (meter): ");
    batchInputPanel.add(
        startDepthLabel,
        new GridConstraints(
            4,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(195, 16),
            null,
            0,
            false));
    depthIncLabel = new JLabel("Depth Increment (meter): ");
    batchInputPanel.add(
        depthIncLabel,
        new GridConstraints(
            5,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(195, 16),
            null,
            0,
            false));

    dpiXField = new JTextField();
    dpiXField.setEnabled(false);
    dpiXField.setHorizontalAlignment(11);

    dpiYField = new JTextField();
    dpiYField.setEnabled(false);
    dpiYField.setHorizontalAlignment(11);

    batchInputPanel.add(
        dpiXField,
        new GridConstraints(
            2,
            1,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_WANT_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(100, -1),
            null,
            0,
            false));

    batchInputPanel.add(
        dpiYField,
        new GridConstraints(
            3,
            1,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_WANT_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(100, -1),
            null,
            0,
            false));

    startDepthField = new JTextField();
    startDepthField.setEnabled(false);
    startDepthField.setHorizontalAlignment(11);

    batchInputPanel.add(
        startDepthField,
        new GridConstraints(
            4,
            1,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_WANT_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(100, -1),
            null,
            0,
            false));
    depthIncField = new JTextField();
    depthIncField.setEnabled(false);
    depthIncField.setHorizontalAlignment(11);

    batchInputPanel.add(
        depthIncField,
        new GridConstraints(
            5,
            1,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_WANT_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(100, -1),
            null,
            0,
            false));
    final JPanel applyPanel = new JPanel();
    applyPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    batchInputPanel.add(
        applyPanel,
        new GridConstraints(
            6,
            0,
            1,
            2,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_BOTH,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            null,
            null,
            null,
            0,
            false));
    applyToAllButton = new JButton("Apply to All Rows");
    applyToAllButton.setEnabled(false);
    applyPanel.add(
        applyToAllButton,
        new GridConstraints(
            0,
            1,
            1,
            1,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            null,
            null,
            0,
            false));
    applyToSelectedButton = new JButton("Apply to Selected Rows");
    applyToSelectedButton.setEnabled(false);
    applyPanel.add(
        applyToSelectedButton,
        new GridConstraints(
            0,
            0,
            1,
            1,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            null,
            null,
            0,
            false));
    //		final Spacer spacer4 = new Spacer();
    //		applyPanel.add(spacer4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
    // GridConstraints.FILL_HORIZONTAL,
    //				GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    orientationComboBox = new JComboBox();
    orientationComboBox.setEnabled(false);
    final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
    defaultComboBoxModel1.addElement("Horizontal");
    defaultComboBoxModel1.addElement("Vertical");
    defaultComboBoxModel1.addElement("[Blank]");
    orientationComboBox.setModel(defaultComboBoxModel1);
    orientationComboBox.setSelectedIndex(2); // [Blank]

    batchInputPanel.add(
        orientationComboBox,
        new GridConstraints(
            0,
            1,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            null,
            null,
            0,
            false));
    lengthLabel = new JLabel("Length (meter): ");
    batchInputPanel.add(
        lengthLabel,
        new GridConstraints(
            1,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            null,
            null,
            0,
            false));
    lengthField = new JTextField();
    lengthField.setEnabled(false);
    lengthField.setHorizontalAlignment(11);

    batchInputPanel.add(
        lengthField,
        new GridConstraints(
            1,
            1,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_WANT_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(150, -1),
            null,
            0,
            false));
    orientationLabel = new JLabel("Orientation: ");
    batchInputPanel.add(
        orientationLabel,
        new GridConstraints(
            0,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            new Dimension(195, 16),
            null,
            0,
            false));
    useBatchInputCheckbox = new JCheckBox();
    useBatchInputCheckbox.setText("Batch input: blank fields will not be applied");
    this.add(
        useBatchInputCheckbox,
        new GridConstraints(
            1,
            0,
            1,
            1,
            GridConstraints.ANCHOR_WEST,
            GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            null,
            null,
            0,
            false));

    onBatch();
  }
예제 #22
0
  public MyFrame(String title, Color col) {
    setTitle(title); // title is set in main method
    setSize(500, 500); // this may need changed but looks ok
    setLocationRelativeTo(null); // sets the location as the centre of the screen
    setResizable(false);

    Container c = getContentPane(); // container to hold the different panels
    c.setBackground(Color.white); // col from main
    c.setLayout(null); // no layout selected so we can place anywhere

    // add to container

    ImageIcon gameLogo =
        new ImageIcon(
            new ImageIcon(getClass().getResource("GameLogobBlank.png"))
                .getImage()
                .getScaledInstance(360, 80, java.awt.Image.SCALE_SMOOTH));
    JPanel logoPanel = new JPanel();
    JLabel logoLabel = new JLabel("", gameLogo, JLabel.CENTER);
    logoPanel.setBounds(50, 45, gameLogo.getIconWidth() + 20, gameLogo.getIconHeight() + 20);
    logoPanel.setBackground(Color.white);
    logoPanel.add(logoLabel);
    c.add(logoPanel);

    ImageIcon qubLogo =
        new ImageIcon(new ImageIcon(getClass().getResource("QUBLogo.png")).getImage());
    JPanel qubLogoPanel = new JPanel();
    JLabel qubLogoLabel = new JLabel("", qubLogo, JLabel.CENTER);
    qubLogoPanel.setBounds(15, 380, qubLogo.getIconWidth() + 10, qubLogo.getIconHeight() + 10);
    qubLogoPanel.setBackground(Color.white);
    qubLogoPanel.add(qubLogoLabel);
    c.add(qubLogoPanel);

    ImageIcon seseLogo =
        new ImageIcon(
            new ImageIcon(getClass().getResource("seseLogo.png"))
                .getImage()
                .getScaledInstance(120, 45, java.awt.Image.SCALE_SMOOTH));
    JPanel seseLogoPanel = new JPanel();
    JLabel seseLogoLabel = new JLabel("", seseLogo, JLabel.CENTER);
    seseLogoPanel.setBounds(350, 390, seseLogo.getIconWidth() + 10, seseLogo.getIconHeight() + 10);
    seseLogoPanel.setBackground(Color.white);
    seseLogoPanel.add(seseLogoLabel);
    c.add(seseLogoPanel);

    JPanel playerPanel = new JPanel(); // new panel for players
    playerPanel.setBounds(92, 200, 316, 27); // location
    playerPanel.setLayout(new GridLayout(1, 2)); // layout as grid
    playerPanel.setOpaque(false);
    c.add(playerPanel); // add to container

    combo.setBackground(Color.white);
    playerPanel.add(numOfP); // label to tell to select num of players
    playerPanel.add(combo); // drop down menu

    players.setEditable(false);
    players.setHorizontalAlignment(JLabel.CENTER);

    combo.addItemListener(
        new ItemListener() { // this is to set the number of players to be displayed
          public void itemStateChanged(ItemEvent ie) {

            if (ie.getStateChange() == ItemEvent.SELECTED) {
              String str =
                  (String)
                      combo
                          .getSelectedItem(); // if the number changes then change the number of
                                              // player message

              if (str == "2") {
                players.setText("2 players selected");
              }

              if (str == "3") {
                players.setText("3 players selected");
              }

              if (str == "4") {
                players.setText("4 players selected");
              }

              if (str == "5") {
                players.setText("5 players selected");
              }

              if (str == "6") {
                players.setText("6 players selected");
              }
            } // closes if statements
          } // closes method
        } // closes action listener
        ); // closes action listener

    JPanel startPanel = new JPanel(); // start panel for start button
    startPanel.setBounds(123, 239, 254, 70); // location
    startPanel.setLayout(new GridLayout(2, 1)); // using a grid layout
    startPanel.add(players); // text box says number of payers
    startPanel.setBackground(Color.white);

    startButton = new JButton();
    startButton.setText(
        "Start Game!"); // button has the label start												// actual start button
    startPanel.add(startButton); // button added
    startButton.addActionListener(startButtonActionListener); // added actionlistener
    c.add(startPanel); // added to container

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // close when closed
    setVisible(true); // takes off invisability cloak
  } // MyFrame constructor
예제 #23
0
  DeleteCustomer() {

    // super(Title, Resizable, Closable, Maximizable, Iconifiable)
    super("Delete Account Holder", false, true, false, true);
    setSize(350, 235);

    jpDel.setLayout(null);

    lbNo = new JLabel("Account No:");
    lbNo.setForeground(Color.black);
    lbNo.setBounds(15, 20, 80, 25);
    lbName = new JLabel("Person Name:");
    lbName.setForeground(Color.black);
    lbName.setBounds(15, 55, 90, 25);
    lbDate = new JLabel("Last Transaction:");
    lbDate.setForeground(Color.black);
    lbDate.setBounds(15, 90, 100, 25);
    lbBal = new JLabel("Balance:");
    lbBal.setForeground(Color.black);
    lbBal.setBounds(15, 125, 80, 25);

    txtNo = new JTextField();
    txtNo.setHorizontalAlignment(JTextField.RIGHT);
    txtNo.setBounds(125, 20, 200, 25);
    txtName = new JTextField();
    txtName.setEnabled(false);
    txtName.setBounds(125, 55, 200, 25);
    txtDate = new JTextField();
    txtDate.setEnabled(false);
    txtDate.setBounds(125, 90, 200, 25);
    txtBal = new JTextField();
    txtBal.setEnabled(false);
    txtBal.setHorizontalAlignment(JTextField.RIGHT);
    txtBal.setBounds(125, 125, 200, 25);

    // Aligning The Buttons.
    btnDel = new JButton("Delete");
    btnDel.setBounds(20, 165, 120, 25);
    btnDel.addActionListener(this);
    btnCancel = new JButton("Cancel");
    btnCancel.setBounds(200, 165, 120, 25);
    btnCancel.addActionListener(this);

    // Adding the All the Controls to Panel.
    jpDel.add(lbNo);
    jpDel.add(txtNo);
    jpDel.add(lbName);
    jpDel.add(txtName);
    jpDel.add(lbDate);
    jpDel.add(txtDate);
    jpDel.add(lbBal);
    jpDel.add(txtBal);
    jpDel.add(btnDel);
    jpDel.add(btnCancel);

    // Restricting The User Input to only Numerics in Numeric TextBoxes.
    txtNo.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent ke) {
            char c = ke.getKeyChar();
            if (!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE)))) {
              getToolkit().beep();
              ke.consume();
            }
          }
        });
    // Checking the Accunt No. Provided By User on Lost Focus of the TextBox.
    txtNo.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {}

          public void focusLost(FocusEvent fe) {
            if (txtNo.getText().equals("")) {
            } else {
              rows = 0;
              populateArray(); // Load All Existing Records in Memory.
              findRec(); // Finding if Account No. Already Exist or Not.
            }
          }
        });

    // Adding Panel to Window.
    getContentPane().add(jpDel);

    populateArray(); // Load All Existing Records in Memory.

    // In the End Showing the New Account Window.
    setVisible(true);
  }
예제 #24
0
파일: LJ3MDApp.java 프로젝트: eskilj/mvp
  public LJ3MDApp() {
    tNum.setHorizontalAlignment(JTextField.CENTER);
    tTemp.setHorizontalAlignment(JTextField.CENTER);
    tRho.setHorizontalAlignment(JTextField.CENTER);
    tSpeed.setHorizontalAlignment(JTextField.CENTER);

    tAvK.setHorizontalAlignment(JTextField.RIGHT);
    tAvU.setHorizontalAlignment(JTextField.RIGHT);
    tAvp.setHorizontalAlignment(JTextField.RIGHT);

    float[] aveKing = new float[501];
    float[] avePot = new float[501];
    float[] aveEn = new float[501];

    JFrame box = new JFrame();
    box.setLayout(new BorderLayout());
    box.setSize(1000, 1000);
    box.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    cpnl = new JPanel(); // create a panel for controls
    cpnl.setLayout(new GridLayout(18, 2));
    box.add(cpnl, BorderLayout.EAST);

    // add controls
    cpnl.add(bStart);
    bStart.addActionListener(this);

    cpnl.add(bReset);
    bReset.addActionListener(this);

    cpnl.add(new JLabel(" N:"));
    tNum.addActionListener(this);
    cpnl.add(tNum);

    cpnl.add(new JLabel(" Density (\u03c1):"));
    tRho.addActionListener(this);
    cpnl.add(tRho);

    cpnl.add(new JLabel(" Steps/frame:"));
    tSpeed.addActionListener(this);
    cpnl.add(tSpeed);

    cpnl.add(bTstat);
    bTstat.addActionListener(this);

    cpnl.add(bPot);
    bPot.addActionListener(this);

    cpnl.add(new JLabel(" < K/N > :"));
    tAvK.setEditable(false);
    cpnl.add(tAvK);

    cpnl.add(new JLabel(" Temperature:"));
    tTemp.setEditable(false);
    cpnl.add(tTemp);

    cpnl.add(new JLabel(" < U/N > :"));
    tAvU.setEditable(false);
    cpnl.add(tAvU);

    cpnl.add(new JLabel(" < pressure > :"));
    tAvp.setEditable(false);
    cpnl.add(tAvp);

    cpnl.add(bRetime);
    bRetime.addActionListener(this);

    spnl = new JPanel(); // create a panel for status
    box.add(spnl, BorderLayout.SOUTH);
    lStatus.setFont(new Font("Courier", 0, 12));
    spnl.add(lStatus);

    canvas = new XYZCanvas();
    box.add(canvas, BorderLayout.CENTER);

    timer = new Timer(delay, this);
    timer.start();
    //        timer.stop();
    box.setVisible(true);
  }
예제 #25
0
 private void updateStatus(int lineNumber, int columnNumber) {
   status.setText("第 " + lineNumber + " 行, 第 " + columnNumber + " 列  ");
   status.setHorizontalAlignment(JTextField.RIGHT);
 }
예제 #26
0
  public void init() {
    d = getSize();
    resize(d.width, d.height);
    GridBagLayout g = new GridBagLayout();
    setLayout(g);
    GridBagConstraints gC = new GridBagConstraints();

    // first row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 10, 0);
    gC.gridy = 0;
    gC.gridwidth = 5;
    gC.fill = GridBagConstraints.BOTH;
    txt = new JTextField();
    txt.setHorizontalAlignment(JTextField.RIGHT);
    txt.setEditable(false);
    g.setConstraints(txt, gC);
    add(txt);

    // second row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b7 = new JButton("7");
    b7.setForeground(Color.BLACK);
    b7.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b7, gC);
    add(b7);

    gC = new GridBagConstraints();
    gC.fill = GridBagConstraints.HORIZONTAL;
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b8 = new JButton("8");
    b8.setForeground(Color.BLACK);
    b8.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b8, gC);
    add(b8);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b9 = new JButton("9");
    b9.setForeground(Color.BLACK);
    b9.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b9, gC);
    add(b9);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bAdd = new JButton("+");
    bAdd.setForeground(Color.BLUE);
    bAdd.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bAdd, gC);
    add(bAdd);

    // third row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b4 = new JButton("4");
    b4.setForeground(Color.BLACK);
    b4.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b4, gC);
    add(b4);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b5 = new JButton("5");
    b5.setForeground(Color.BLACK);
    b5.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b5, gC);
    add(b5);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b6 = new JButton("6");
    b6.setForeground(Color.BLACK);
    b6.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b6, gC);
    add(b6);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bDec = new JButton("-");
    bDec.setForeground(Color.BLUE);
    bDec.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bDec, gC);
    add(bDec);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.gridheight = 2;
    gC.fill = GridBagConstraints.BOTH;
    bC = new JButton("C");
    bC.setForeground(Color.RED);
    bC.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bC, gC);
    add(bC);

    // fourth row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b1 = new JButton("1");
    b1.setForeground(Color.BLACK);
    b1.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b1, gC);
    add(b1);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b2 = new JButton("2");
    b2.setForeground(Color.BLACK);
    b2.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b2, gC);
    add(b2);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b3 = new JButton("3");
    b3.setForeground(Color.BLACK);
    b3.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b3, gC);
    add(b3);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bMul = new JButton("*");
    bMul.setForeground(Color.BLUE);
    bMul.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bMul, gC);
    add(bMul);

    // fifth row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 4;
    gC.gridwidth = 2;
    gC.fill = GridBagConstraints.BOTH;
    b0 = new JButton("0");
    b0.setForeground(Color.BLACK);
    b0.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b0, gC);
    add(b0);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 4;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bPoint = new JButton(".");
    bPoint.setForeground(Color.BLACK);
    bPoint.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(bPoint, gC);
    add(bPoint);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 4;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bDiv = new JButton("/");
    bDiv.setForeground(Color.BLUE);
    bDiv.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bDiv, gC);
    add(bDiv);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.gridheight = 2;
    gC.fill = GridBagConstraints.BOTH;
    bCal = new JButton("=");
    bCal.addActionListener(new setOperator_ActionListener());
    bCal.setForeground(Color.RED);
    g.setConstraints(bCal, gC);
    add(bCal);
  }
예제 #27
0
  /** Create and layout the visual components. */
  private void initComponents() {
    setTitle("Chart Settings");
    setSize(new Dimension(450, 375));
    setResizable(false);

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    Box mainView = new Box(VERTICAL);
    getContentPane().add(mainView);

    Box row;

    Box yAxisView = new Box(VERTICAL);
    yAxisView.setBorder(border);
    mainView.add(yAxisView);

    yAutoScaleCheckbox = new JCheckBox("Auto Scale");
    yAutoScaleCheckbox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            yAutoScaleCheckboxActionPerformed(evt);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(yAutoScaleCheckbox);
    yAxisView.add(row);

    yAxisMinValueField = new JTextField(10);
    yAxisMinValueField.setMaximumSize(yAxisMinValueField.getPreferredSize());
    yAxisMinValueField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    yAxisMinValueField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisMinValueField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisMinValueField.setCaretPosition(0);
            yAxisMinValueField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Min:"));
    row.add(yAxisMinValueField);
    yAxisView.add(row);

    yAxisMaxValueField = new JTextField(10);
    yAxisMaxValueField.setMaximumSize(yAxisMaxValueField.getPreferredSize());
    yAxisMaxValueField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    yAxisMaxValueField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisMaxValueField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisMaxValueField.setCaretPosition(0);
            yAxisMaxValueField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Max:"));
    row.add(yAxisMaxValueField);
    yAxisView.add(row);

    yAxisDivisionsField = new JTextField(10);
    yAxisDivisionsField.setMaximumSize(yAxisDivisionsField.getPreferredSize());
    yAxisDivisionsField.setHorizontalAlignment(JTextField.RIGHT);
    yAxisDivisionsField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisDivisionsField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisDivisionsField.setCaretPosition(0);
            yAxisDivisionsField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Major Divisions:"));
    row.add(yAxisDivisionsField);
    yAxisView.add(row);

    Box buttonView = new Box(HORIZONTAL);
    mainView.add(buttonView);
    buttonView.add(Box.createHorizontalGlue());

    JButton revertButton = new JButton("Revert");
    revertButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            revertButtonActionPerformed(event);
          }
        });
    buttonView.add(revertButton);

    JButton applyButton = new JButton("Apply");
    applyButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            applyButtonActionPerformed(event);
          }
        });
    buttonView.add(applyButton);

    pack();
  }
예제 #28
0
파일: GenXml.java 프로젝트: abel533/EasyXls
  /** Create the frame. */
  public GenXml() {
    setResizable(false);
    setTitle("XML生成向导");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 670, 500);
    contentPane = new JPanel();
    contentPane.setBorder(new LineBorder(Color.DARK_GRAY, 4));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));

    btnpanel = new JPanel();
    btnpanel.setBackground(Color.DARK_GRAY);
    btnpanel.setBorder(new LineBorder(Color.DARK_GRAY));
    btnpanel.setPreferredSize(new Dimension(10, 60));
    contentPane.add(btnpanel, BorderLayout.SOUTH);
    btnpanel.setLayout(null);

    prevBtn = new JButton("上一步");
    prevBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            prev();
          }
        });
    prevBtn.setEnabled(false);
    prevBtn.setBounds(294, 10, 113, 40);
    btnpanel.add(prevBtn);

    nextBtn = new JButton("下一步");
    nextBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            next();
          }
        });
    nextBtn.setBounds(417, 10, 113, 40);
    btnpanel.add(nextBtn);

    doneBtn = new JButton("完成");
    doneBtn.addActionListener(doneListener);
    doneBtn.setEnabled(false);
    doneBtn.setBounds(540, 10, 113, 40);
    btnpanel.add(doneBtn);

    card = new CardLayout(0, 0);
    pane = new JPanel(card);
    contentPane.add(pane, BorderLayout.CENTER);

    step1 = new JPanel();
    step1.setBackground(Color.LIGHT_GRAY);
    step1.setBorder(new LineBorder(new Color(0, 0, 0)));
    pane.add(step1, "name_287780550285180");
    step1.setLayout(null);

    JLabel label = new JLabel("请输入类名(全路径):");
    label.setFont(new Font("宋体", Font.PLAIN, 18));
    label.setBounds(10, 42, 344, 43);
    step1.add(label);

    classPath = new JTextField();
    classPath.setForeground(Color.BLACK);
    classPath.setBackground(Color.WHITE);
    classPath.setFont(new Font("宋体", Font.BOLD, 20));
    classPath.setBounds(10, 95, 636, 52);
    step1.add(classPath);
    classPath.setColumns(10);

    JLabel lblxml = new JLabel("保存xml路径(全路径):");
    lblxml.setFont(new Font("宋体", Font.PLAIN, 18));
    lblxml.setBounds(10, 218, 344, 43);
    step1.add(lblxml);

    filePath = new JTextField();
    // 默认使用当前路径
    String path = GenXml.class.getResource("/").getPath();
    if (path.startsWith("/")) {
      path = path.substring(1);
    }
    filePath.setText(path);
    filePath.setForeground(Color.BLACK);
    filePath.setFont(new Font("宋体", Font.BOLD, 20));
    filePath.setColumns(10);
    filePath.setBackground(Color.WHITE);
    filePath.setBounds(10, 271, 636, 52);
    step1.add(filePath);

    step2 = new JPanel();
    step2.setBackground(Color.LIGHT_GRAY);
    step2.setBorder(new LineBorder(new Color(0, 0, 0)));
    pane.add(step2, "name_287788958231594");
    step2.setLayout(new BorderLayout(0, 0));

    JScrollPane scrollPane = new JScrollPane();
    step2.add(scrollPane);

    table = new JTable();
    table.setRowHeight(30);
    table.setAutoCreateRowSorter(true);
    table.setDragEnabled(true);
    table.setFont(new Font("宋体", Font.PLAIN, 18));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setForeground(Color.BLACK);
    table.setBackground(Color.WHITE);
    table.setModel(
        new DefaultTableModel(
            new Object[][] {},
            new String[] {"\u5B57\u6BB5\u540D", "\u7C7B\u578B", "\u5217\u540D"}));
    table.getColumnModel().getColumn(0).setPreferredWidth(120);
    table.getColumnModel().getColumn(1).setPreferredWidth(200);
    table.getColumnModel().getColumn(2).setPreferredWidth(120);
    scrollPane.setViewportView(table);

    panel_1 = new JPanel();
    panel_1.setPreferredSize(new Dimension(10, 40));
    step2.add(panel_1, BorderLayout.NORTH);
    panel_1.setLayout(null);

    label_1 = new JLabel("需要显示的属性:");
    label_1.setBounds(10, 10, 157, 22);
    panel_1.add(label_1);

    panel_2 = new JPanel();
    panel_2.setPreferredSize(new Dimension(100, 10));
    step2.add(panel_2, BorderLayout.EAST);
    panel_2.setLayout(null);

    reset = new JButton("重置");
    reset.setBounds(3, 0, 93, 25);
    panel_2.add(reset);

    mvT = new JButton("向上");
    mvT.setBounds(3, 30, 93, 25);
    panel_2.add(mvT);

    mvD = new JButton("向下");
    mvD.setBounds(3, 60, 93, 25);
    panel_2.add(mvD);

    delBtn = new JButton("删除");
    delBtn.setBounds(3, 90, 93, 25);
    panel_2.add(delBtn);
    delBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // 删除选中列
            DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
            int row = table.getSelectedRow();
            if (row > -1) {
              tableModel.removeRow(row);
              if (row < table.getRowCount()) {
                table.getSelectionModel().setSelectionInterval(row, row);
              } else if (row > 1) {
                table.getSelectionModel().setSelectionInterval(row, row);
              }
            }
          }
        });
    mvD.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // 移动选中列
            DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
            int row = table.getSelectedRow();
            if (row < table.getRowCount()) {
              tableModel.moveRow(row, row, ++row);
              table.getSelectionModel().setSelectionInterval(row, row);
            }
          }
        });
    mvT.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // 移动选中列
            DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
            int row = table.getSelectedRow();
            if (row > 0) {
              tableModel.moveRow(row, row, --row);
              table.getSelectionModel().setSelectionInterval(row, row);
            }
          }
        });
    reset.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ReadInTable(classPath.getText());
          }
        });

    step3 = new JPanel();
    step3.setBackground(Color.LIGHT_GRAY);
    step3.setBorder(new LineBorder(new Color(0, 0, 0)));
    pane.add(step3, "name_287798491067114");
    step3.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panel.setBackground(Color.LIGHT_GRAY);
    panel.setBorder(new LineBorder(new Color(0, 0, 0)));
    step3.add(panel);
    panel.setLayout(null);

    lblsheet = new JLabel("sheet序号:");
    lblsheet.setBounds(106, 226, 99, 15);
    panel.add(lblsheet);

    label_3 = new JLabel("开始行号:");
    label_3.setBounds(106, 291, 99, 24);
    panel.add(label_3);

    lblSheet = new JLabel("sheet名称:");
    lblSheet.setBounds(106, 261, 99, 15);
    panel.add(lblSheet);

    label_4 = new JLabel("是否缓存:");
    label_4.setBounds(106, 191, 99, 15);
    panel.add(label_4);

    cache = new JCheckBox("选中为缓存(不选为不缓存)");
    cache.setSelected(true);
    cache.setBounds(215, 184, 312, 30);
    panel.add(cache);

    sheet = new JTextField();
    sheet.setText("Sheet0");
    sheet.setColumns(10);
    sheet.setBounds(215, 254, 312, 30);
    panel.add(sheet);

    sheetNum = new JTextField();
    sheetNum.setHorizontalAlignment(SwingConstants.CENTER);
    sheetNum.setBackground(Color.DARK_GRAY);
    sheetNum.setForeground(Color.WHITE);
    sheetNum.setEnabled(false);
    sheetNum.setBounds(461, 219, 66, 30);
    panel.add(sheetNum);
    sheetNum.setColumns(10);

    startRow = new JTextField();
    startRow.setHorizontalAlignment(SwingConstants.CENTER);
    startRow.setForeground(Color.WHITE);
    startRow.setBackground(Color.DARK_GRAY);
    startRow.setEnabled(false);
    startRow.setColumns(10);
    startRow.setBounds(461, 289, 66, 30);
    panel.add(startRow);

    sliderRow = new JSlider();
    sliderRow.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            startRow.setText("" + sliderRow.getValue());
          }
        });
    sliderRow.setMaximum(10);
    sliderRow.setValue(0);
    sliderRow.setBounds(215, 289, 240, 30);
    panel.add(sliderRow);

    sliderSheet = new JSlider();
    sliderSheet.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            sheetNum.setText("" + sliderSheet.getValue());
          }
        });
    sliderSheet.setValue(0);
    sliderSheet.setMaximum(10);
    sliderSheet.setBounds(215, 219, 240, 30);
    panel.add(sliderSheet);

    label_2 = new JLabel("           基本信息:");
    label_2.setPreferredSize(new Dimension(60, 35));
    step3.add(label_2, BorderLayout.NORTH);
  }
  private JPanel createForm() {
    JCheckBox enabledCheckBox = new JCheckBox(Finder.getString("vhost.ssl.edit.enable"));

    new CheckBoxPropertySynchronizer(enabledProperty, enabledCheckBox);
    ChangeIndicator enabledChange = new ChangeIndicator();
    enabledProperty.addChangeListener(enabledChange);

    JLabel iPLabel = new JLabel(Finder.getString("vhost.ssl.edit.ip"));
    JTextField iPField = GUIUtil.createTextField();
    new TextComponentPropertySynchronizer<String, JTextComponent>(ipProperty, iPField);
    ChangeIndicator iPChange = new ChangeIndicator();
    ipProperty.addChangeListener(iPChange);

    JLabel portLabel = new JLabel(Finder.getString("vhost.ssl.edit.port"));

    SpinnerNumberModel portModel = new SpinnerNumberModel(0, 0, Short.MAX_VALUE, 1);
    JSpinner portSpinner = new JSpinner(portModel);

    JComponent editor = portSpinner.getEditor();
    if (editor instanceof JSpinner.DefaultEditor) {
      JTextField field = ((JSpinner.DefaultEditor) editor).getTextField();
      field.setColumns(5);
      field.setHorizontalAlignment(JTextField.RIGHT);
    }

    new SpinnerNumberModelPropertySynchronizer(portProperty, portModel, false);
    portProperty.save();

    ChangeIndicator portChange = new ChangeIndicator();
    portProperty.addChangeListener(portChange);

    JLabel certLabel = new JLabel(Finder.getString("vhost.ssl.edit.certificate"));

    BrowsableFilePanel certPanel = new BrowsableFilePanel();
    certPanel.setOpaque(false);
    fileChoosers.add(certPanel.getFileChooser());

    new TextComponentPropertySynchronizer<String, JTextComponent>(
        certProperty, certPanel.getField());
    ChangeIndicator certChange = new ChangeIndicator();
    certProperty.addChangeListener(certChange);

    JLabel keyLabel = new JLabel(Finder.getString("vhost.ssl.edit.key"));

    BrowsableFilePanel keyPanel = new BrowsableFilePanel();
    keyPanel.setOpaque(false);
    fileChoosers.add(keyPanel.getFileChooser());

    new TextComponentPropertySynchronizer<String, JTextComponent>(keyProperty, keyPanel.getField());
    ChangeIndicator keyChange = new ChangeIndicator();
    keyProperty.addChangeListener(keyChange);

    JPanel formPanel = new JPanel();
    formPanel.setOpaque(false);

    Form form = new Form(formPanel, VerticalAnchor.TOP);

    int hGap = GUIUtil.getHalfGap();
    int sGap = 3 * hGap;
    int indent = GUIUtil.getTextXOffset(enabledCheckBox);

    ColumnLayoutConstraint c = new ColumnLayoutConstraint(HorizontalAnchor.FILL, hGap);

    RowLayoutConstraint r = new RowLayoutConstraint(VerticalAnchor.CENTER, hGap);

    HasAnchors a = new SimpleHasAnchors(HorizontalAnchor.LEFT, VerticalAnchor.CENTER);

    form.addRow(HorizontalAnchor.LEFT, c);
    form.add(enabledCheckBox, r);
    form.add(enabledChange, r);

    form.addTable(2, hGap, hGap, HorizontalAnchor.LEFT, c.setGap(sGap));
    form.add(iPLabel, a);
    form.add(getRow(hGap, iPField, iPChange), a);
    form.add(portLabel, a);
    form.add(getRow(hGap, portSpinner, portChange), a);
    form.add(certLabel, a);
    form.add(getRow(hGap, certPanel, certChange), a);
    form.add(keyLabel, a);
    form.add(getRow(hGap, keyPanel, keyChange), a);

    return formPanel;
  }
  /**
   * Gets the tableCellEditorComponent attribute of the SVTableCellEditor object
   *
   * @return The tableCellEditorComponent value
   */
  public Component getTableCellEditorComponent(
      JTable table, Object value, boolean isSelected, int row, int column) {
    System.out.println("GetTableCellEditorComponent");
    HSSFCell cell = (HSSFCell) value;
    if (cell != null) {
      HSSFCellStyle style = cell.getCellStyle();
      HSSFFont f = wb.getFontAt(style.getFontIndex());
      boolean isbold = f.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
      boolean isitalics = f.getItalic();

      int fontstyle = Font.PLAIN;

      if (isbold) fontstyle = Font.BOLD;
      if (isitalics) fontstyle = fontstyle | Font.ITALIC;

      int fontheight = f.getFontHeightInPoints();
      if (fontheight == 9) fontheight = 10; // fix for stupid ol Windows

      Font font = new Font(f.getFontName(), fontstyle, fontheight);
      editor.setFont(font);

      if (style.getFillPattern() == HSSFCellStyle.SOLID_FOREGROUND) {
        editor.setBackground(getAWTColor(style.getFillForegroundColor(), white));
      } else editor.setBackground(white);

      editor.setForeground(getAWTColor(f.getColor(), black));

      // Set the value that is rendered for the cell
      switch (cell.getCellType()) {
        case HSSFCell.CELL_TYPE_BLANK:
          editor.setText("");
          break;
        case HSSFCell.CELL_TYPE_BOOLEAN:
          if (cell.getBooleanCellValue()) {
            editor.setText("true");
          } else {
            editor.setText("false");
          }
          break;
        case HSSFCell.CELL_TYPE_NUMERIC:
          editor.setText(Double.toString(cell.getNumericCellValue()));
          break;
        case HSSFCell.CELL_TYPE_STRING:
          editor.setText(cell.getRichStringCellValue().getString());
          break;
        case HSSFCell.CELL_TYPE_FORMULA:
        default:
          editor.setText("?");
      }
      switch (style.getAlignment()) {
        case HSSFCellStyle.ALIGN_LEFT:
        case HSSFCellStyle.ALIGN_JUSTIFY:
        case HSSFCellStyle.ALIGN_FILL:
          editor.setHorizontalAlignment(SwingConstants.LEFT);
          break;
        case HSSFCellStyle.ALIGN_CENTER:
        case HSSFCellStyle.ALIGN_CENTER_SELECTION:
          editor.setHorizontalAlignment(SwingConstants.CENTER);
          break;
        case HSSFCellStyle.ALIGN_GENERAL:
        case HSSFCellStyle.ALIGN_RIGHT:
          editor.setHorizontalAlignment(SwingConstants.RIGHT);
          break;
        default:
          editor.setHorizontalAlignment(SwingConstants.LEFT);
          break;
      }
    }
    return editor;
  }