/** @param model */
  private void build(CalendarModel model) {
    this._support = new CalendarSupport(model, new ModelListener());

    FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT);
    flowLayout.setHgap(3);
    flowLayout.setVgap(0);

    JPanel p = this._fieldPanel;
    JTextField hf = this._hourField;
    JTextField mf = this._minuteField;
    JTextField sf = this._secondField;

    p.setLayout(flowLayout);
    p.add(hf);
    p.add(this._hmSeparator);
    p.add(mf);
    p.add(this._msSeparator);
    p.add(sf);

    hf.setHorizontalAlignment(RIGHT);
    mf.setHorizontalAlignment(RIGHT);
    sf.setHorizontalAlignment(RIGHT);

    hf.setDocument(IntegerRangeLimitedDocument.decorate(hf.getDocument(), 0, 23));
    mf.setDocument(IntegerRangeLimitedDocument.decorate(mf.getDocument(), 0, 59));
    sf.setDocument(IntegerRangeLimitedDocument.decorate(sf.getDocument(), 0, 59));

    setLayout(new BorderLayout());
    this.add(p, BorderLayout.CENTER);
    updateUI();

    this._changedUI = true;
  }
Exemple #2
0
  private JPanel setUpStatisticsPanel() {
    JPanel statistics = new JPanel();

    statistics.setLayout(new GridLayout(5, 2));
    statistics.add(new JLabel("STATISTICS", SwingConstants.CENTER));

    JPanel nrSpannedVertices = new JPanel();
    nrSpannedVertices.setLayout(new GridLayout(1, 2));

    JLabel nrSpannedVerticesLabel = new JLabel("vertices");
    nrSpannedVerticesField = new JTextField("0");
    nrSpannedVerticesField.setHorizontalAlignment(JTextField.RIGHT);
    nrSpannedVertices.add(nrSpannedVerticesLabel);
    nrSpannedVertices.add(nrSpannedVerticesField);

    statistics.add(nrSpannedVertices);

    JPanel nrEdges = new JPanel();
    nrEdges.setLayout(new GridLayout(1, 2));

    JLabel nrEdgesLabel = new JLabel("edges");
    nrEdgesField = new JTextField("0");
    nrEdgesField.setHorizontalAlignment(JTextField.RIGHT);
    nrEdges.add(nrEdgesLabel);
    nrEdges.add(nrEdgesField);

    statistics.add(nrEdges);

    JPanel nrFaces = new JPanel();
    nrFaces.setLayout(new GridLayout(1, 2));

    JLabel nrFacesLabel = new JLabel("faces");
    nrFacesField = new JTextField("0");
    nrFacesField.setHorizontalAlignment(JTextField.RIGHT);
    nrFaces.add(nrFacesLabel);
    nrFaces.add(nrFacesField);

    statistics.add(nrFaces);

    JPanel nrCells = new JPanel();
    nrCells.setLayout(new GridLayout(1, 2));

    JLabel nrCellsLabel = new JLabel("cells");
    nrCellsField = new JTextField("0");
    nrCellsField.setHorizontalAlignment(JTextField.RIGHT);
    nrCells.add(nrCellsLabel);
    nrCells.add(nrCellsField);

    statistics.add(nrCells);
    return statistics;
  }
  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;
  }
Exemple #4
0
  public Calculator() {
    setLayout(new BorderLayout());
    add(textResult, BorderLayout.NORTH);
    textResult.setHorizontalAlignment(JTextField.RIGHT);

    for (int i = 0; i < 18; i++) {
      btnInput[i] = new JButton(buttonText[i]);
      btnInput[i].addActionListener(this);
    }

    JPanel numInputPanel = new JPanel(new GridLayout(4, 4));
    for (int i = 0; i < 16; i++) {
      numInputPanel.add(btnInput[i]);
    }

    JPanel resultInputPanel = new JPanel(new GridLayout(2, 1));
    resultInputPanel.add(btnInput[16]);
    resultInputPanel.add(btnInput[17]);

    add(numInputPanel, BorderLayout.CENTER);
    add(resultInputPanel, BorderLayout.EAST);

    setVisible(true);
    setDefaultCloseOperation(3);
    pack();
  }
  // filter2d_freq
  public void filter2d_freq_window() {
    fr = new JFrame();
    panel = new JPanel();
    label = new JLabel();
    tf = new JTextField();
    bt = new JButton();

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    fr.setLocation((screenSize.width - 260) / 2, (screenSize.height - 100) / 2);

    fr.setSize(260, 100);
    fr.setVisible(true);

    panel.setLayout(new GridLayout(3, 1));
    label = new JLabel("请选择操作,0(平滑),1(锐化)");
    label.setHorizontalAlignment(JLabel.CENTER);
    tf.setHorizontalAlignment(JTextField.CENTER);
    bt.setText("确定");
    panel.add(label);
    panel.add(tf);
    panel.add(bt);

    fr.getContentPane().add(panel, BorderLayout.CENTER);

    bt.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            fr.dispose();
            filter2d_freq(Integer.parseInt(tf.getText()));
          }
        });
  }
  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);
  }
  /** Creates a new instance of IntegerPropertyEditor */
  public IntegerPropertyEditor() {
    super();

    Component c = this.getCustomEditor();
    if (c instanceof JTextField) {
      ((JTextField) c).setHorizontalAlignment(JTextField.RIGHT);
    }
  }
  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);
  }
 private void addWelcomeMessage(String welcomeMsg) {
   JTextField welcomeMessage = new JTextField(welcomeMsg);
   welcomeMessage.setBounds(BOUNDS_WELCOME_MESSAGE);
   welcomeMessage.setHorizontalAlignment(JTextField.CENTER);
   welcomeMessage.setBorder(BorderFactory.createEmptyBorder());
   welcomeMessage.setFont(ClientUI.FONT_BOLD);
   welcomeMessage.setEditable(false);
   contentPanel.add(welcomeMessage);
 }
 /**
  * Defines the y-axis -logPvalue
  *
  * @return
  */
 protected JTextField getRegulomeField() {
   if (regulomeField == null) {
     regulomeField = new JTextField(4);
     regulomeField.setText("");
     regulomeField.setBackground(Color.WHITE);
     regulomeField.setHorizontalAlignment(JTextField.CENTER);
     regulomeField.setEditable(false);
   }
   return regulomeField;
 }
 /**
  * Defines the y-axis -logPvalue
  *
  * @return
  */
 protected JTextField getSnpGeneField() {
   if (snpGeneField == null) {
     snpGeneField = new JTextField(11);
     snpGeneField.setText("");
     snpGeneField.setBackground(Color.WHITE);
     snpGeneField.setHorizontalAlignment(JTextField.CENTER);
     snpGeneField.setEditable(false);
   }
   return snpGeneField;
 }
 private void addErrorMessagePlaceholder() {
   errorMessage = new JTextField();
   errorMessage.setForeground(COLOR_DANGER);
   errorMessage.setBounds(BOUNDS_LOGIN_ERROR_MESSAGE);
   errorMessage.setFont(ClientUI.FONT_NORMAL);
   errorMessage.setHorizontalAlignment(JTextField.CENTER);
   errorMessage.setBorder(BorderFactory.createEmptyBorder());
   errorMessage.setEditable(false);
   contentPanel.add(errorMessage);
 }
 /**
  * Defines the model value field that displays the model name of the current position
  *
  * @return
  */
 protected JTextField getModelValueField() {
   if (modelValueField == null) {
     modelValueField = new JTextField(33);
     modelValueField.setText("");
     modelValueField.setBackground(Color.WHITE);
     modelValueField.setHorizontalAlignment(JTextField.CENTER);
     modelValueField.setEditable(false);
   }
   return modelValueField;
 }
 /**
  * Defines the intron/exon field
  *
  * @return
  */
 protected JTextField getIntronExonField() {
   if (intronExonField == null) {
     intronExonField = new JTextField(3);
     intronExonField.setText("");
     intronExonField.setBackground(Color.WHITE);
     intronExonField.setHorizontalAlignment(JTextField.CENTER);
     intronExonField.setEditable(false);
   }
   return intronExonField;
 }
 /**
  * Defines the y-axis -logPvalue
  *
  * @return
  */
 protected JTextField getPValueField() {
   if (pValueField == null) {
     pValueField = new JTextField(1);
     pValueField.setText("");
     pValueField.setBackground(Color.WHITE);
     pValueField.setHorizontalAlignment(JTextField.CENTER);
     pValueField.setEditable(false);
   }
   return pValueField;
 }
  /**
   * 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]);
    }
  }
  /** Create the frame. */
  public Frame() {
    setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(
                Frame.class.getResource("/nl/compra/CompraSiteMapperGUI/Resources/compra.png")));

    setTitle("Compra Sitemap Generator");
    setResizable(false);

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 668, 455);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);

    getContentPane().setLayout(null);
    contentPane.setLayout(null);

    JLabel lblUrl = new JLabel("URL:");
    lblUrl.setBounds(6, 11, 28, 16);
    getContentPane().add(lblUrl);

    textFieldURL = new JTextField();
    textFieldURL.setHorizontalAlignment(SwingConstants.LEFT);
    textFieldURL.setBounds(32, 5, 499, 28);
    textFieldURL.setToolTipText("Enter a URL for the crawler to crawl");
    getContentPane().add(textFieldURL);
    textFieldURL.setColumns(10);

    JButton btnCrawl = new JButton("Crawl");
    btnCrawl.setBounds(541, 5, 108, 28);
    btnCrawl.setAction(action);
    getContentPane().add(btnCrawl);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(6, 39, 643, 373);
    getContentPane().add(scrollPane_1);

    textAreaLog = new JTextArea();
    scrollPane_1.setViewportView(textAreaLog);
    textAreaLog.setDropMode(DropMode.INSERT);
    textAreaLog.setTabSize(4);
  }
Exemple #18
0
  public JTextField buildField(int n) {
    final JTextField field = new JTextField("00", 2);
    field.setBorder(BorderFactory.createEmptyBorder());
    field.setHorizontalAlignment(JTextField.CENTER);
    field.addFocusListener(new SelectAllFocusListener());

    field.addFocusListener(
        new FocusAdapter() {
          String oldText = "";

          @Override
          public void focusGained(FocusEvent e) {
            oldText = field.getText();
            super.focusGained(e);
          }

          @Override
          public void focusLost(FocusEvent e) {
            try {
              Integer i = Integer.parseInt(field.getText(), 16);
              if (i < 0 || i > 255) field.setText(oldText);
            } catch (Exception ex) {
              field.setText(oldText);
            }
            super.focusLost(e);
          }
        });

    field.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == 9) {
              if (fields[0].isFocusOwner()) fields[1].requestFocus();
              if (fields[1].isFocusOwner())
                //						fields[2].requestFocus();
                //					if (fields[2].isFocusOwner())
                //						fields[3].requestFocus();
                //					if (fields[3].isFocusOwner())
                fields[0].requestFocus();
              e.consume();
            }
            if (ImcId16Editor.this.imcId16Editor.getParent() != null) {
              for (KeyListener ml :
                  ImcId16Editor.this.imcId16Editor.getParent().getKeyListeners()) {
                ml.keyPressed(e);
              }
            }
          }
        });

    return field;
  }
 /**
  * This method initializes txtDisplay
  *
  * @return javax.swing.JTextField
  */
 JTextField getTxtDisplay() {
   if (txtDisplay == null) {
     txtDisplay = new JTextField("");
     txtDisplay.setHorizontalAlignment(javax.swing.JTextField.LEFT);
     txtDisplay.setAlignmentX(0.0F);
     txtDisplay.setPreferredSize(new java.awt.Dimension(250, 20));
     txtDisplay.setText("");
     txtDisplay.setMinimumSize(new java.awt.Dimension(250, 20));
     txtDisplay.setMaximumSize(new java.awt.Dimension(250, 20));
   }
   return txtDisplay;
 }
  // 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
Exemple #21
0
  protected TanitaInstrument() throws Exception {

    // Initialize interface components.
    bodyTypeTxt = new ResultTextField();
    bodyTypeTxt.setHorizontalAlignment(JTextField.LEFT);
    bodyTypeTxt.setPreferredSize(new Dimension(100, 0));
    genderTxt = new ResultTextField();
    genderTxt.setHorizontalAlignment(JTextField.LEFT);
    genderTxt.setPreferredSize(new Dimension(100, 0));
    heightTxt = new ResultTextField();
    weightTxt = new ResultTextField();
    impedanceTxt = new ResultTextField();
    fatPctTxt = new ResultTextField();
    fatMassTxt = new ResultTextField();
    ffmTxt = new ResultTextField();
    tbwTxt = new ResultTextField();
    ageTxt = new ResultTextField();
    bmiTxt = new ResultTextField();
    bmrTxt = new ResultTextField();

    saveDataBtn = new JButton();
    saveDataBtn.setMnemonic('S');
    saveDataBtn.setEnabled(false);

    // Initialize interface components size
    appWindowWidth = 525;
    appWindowHeight = 300;
    gridCol = 2;

    // Initialize serial port.
    portOwnerName = "TANITA Body Composition Analyzer";

    tanitaLocalSettings = new Properties();

    // Test string
    // setTanitaData(parseTanitaData("0,2,185,110.6,431,28.4,31.4,79.2,58.0,27,32.3,9771"));
    // saveDataBtn.setEnabled(true);
    // End Test string
  }
  public JSPrintPreview2(boolean devMode) {
    //	this.devMode = devMode;
    elements = new Vector<Object[]>();

    setBackground(new Color(175, 175, 175));

    setSize(600, 900);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    buttonBar = new JPanel();
    buttonBar.setLayout(new GridLayout(1, 5));
    if (devMode) {
      coordinateField = new JTextField("- - -,  - - -");
      coordinateField.setHorizontalAlignment(CENTER);
      coordinateField.setEditable(false);
      coordinateField.setPreferredSize(new Dimension(120, 30));
      buttonBar.add(coordinateField);
    }

    zoomPanel = new JPanel(new GridLayout(1, 2));

    zoomLabel = new JLabel("Zoom: ", RIGHT);
    zoomPanel.add(zoomLabel);

    String[] zoomLevels = {"25%", "50%", "75%", "100%"};
    zoomBox = new JComboBox(zoomLevels);
    zoomBox.addItemListener(this);
    zoomPanel.add(zoomBox);

    buttonBar.add(zoomPanel);

    printButton = new JButton("Print");
    printButton.addActionListener(this);
    buttonBar.add(printButton);

    paperPanel = new PaperPanel();
    paperPanel.setPreferredSize(new Dimension(600, 725));
    paperPanel.addMouseListener(paperPanel);
    paperPanel.addMouseMotionListener(paperPanel);

    scrollPane = new JScrollPane(paperPanel);
    scrollPane.getVerticalScrollBar().setUnitIncrement(20);

    setLayout(new BorderLayout());
    add("North", buttonBar);
    add("Center", scrollPane);

    currentFont = new Font("Arial", Font.BOLD, 14);
    styleFont = currentFont;
  }
  /** Creates new form JDialogSceltaQuantita */
  public JDialogSceltaQuantita(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();

    tab.setRowHeight(25);
    tab.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

    final JTextField tf = new JTextField();
    tf.setFont(tab.getFont());
    tf.setBorder(BorderFactory.createEmptyBorder());
    tf.setHorizontalAlignment(JTextField.RIGHT);
    tf.addFocusListener(
        new FocusAdapter() {

          @Override
          public void focusGained(FocusEvent e) {
            super.focusGained(e);
            tf.selectAll();
          }
        });
    DefaultCellEditor editor =
        new DefaultCellEditor(tf) {

          @Override
          public Component getTableCellEditorComponent(
              JTable table, Object value, boolean isSelected, int row, int column) {
            JTextField tf =
                (JTextField)
                    super.getTableCellEditorComponent(table, value, isSelected, row, column);
            tf.setText(FormatUtils.formatPerc(CastUtils.toDouble0(value)));
            //                tf.selectAll();
            return tf;
          }

          @Override
          public Object getCellEditorValue() {
            return CastUtils.toDouble(super.getCellEditorValue());
          }

          @Override
          public int getClickCountToStart() {
            return 1;
          }
        };
    tab.getColumn("quantità confermata").setCellEditor(editor);

    //        TableColumn col = tab.getColumn("quantità confermata");
    //        col.setCellEditor(new SpinnerEditor());
  }
  private JTextField createTimeTextField(boolean enableManualTimeControls) {
    JTextField timeTextField = new JTextField(5);
    timeTextField.setName(TIME_FIELD_NAME);
    timeTextField.setHorizontalAlignment(JTextField.RIGHT);

    timeTextField.setEnabled(enableManualTimeControls);

    String manualAccessTokenExpirationTime = profile.getManualAccessTokenExpirationTime();
    if (manualAccessTokenExpirationTime == null) {
      timeTextField.setText("");
    } else {
      timeTextField.setText(manualAccessTokenExpirationTime);
    }
    return timeTextField;
  }
  /**
   * Create the panel for the history setting
   *
   * @return The history setting panel
   */
  private JPanel createHistoryPanel() {
    JPanel historyPanel = new JPanel();
    historyPanel.setBorder(BorderFactory.createTitledBorder(HISTORYTITLE));
    historyPanel.add(new JLabel("History limit:"));

    m_limitField = new JTextField();
    m_limitField.setColumns(INPUTFIELDCOLUMNS);
    m_limitField.setHorizontalAlignment(SwingConstants.TRAILING);
    m_limitField.setText("" + ApplicationSettings.getHistoryLimit());
    m_limitField.setActionCommand("Save");
    m_limitField.addActionListener(this);

    historyPanel.add(m_limitField);
    historyPanel.add(new JLabel("steps"));
    return historyPanel;
  }
  /**
   * Constructeur de la classe
   *
   * @param numJoueur rang du joueur dans la liste des joueurs
   */
  public CadranSaisieInfo(int numJoueur) {

    this.setOpaque(false);
    this.setLayout(null);

    imageCadran.setIcon(
        new ImageIcon(getClass().getResource("/CadranJoueur" + numJoueur + ".png")));
    this.add(imageCadran);
    imageCadran.setBounds(0, 0, 160, 150);

    pseudo.setOpaque(false);
    pseudo.setFont(new java.awt.Font("Wawati SC", 0, 13));
    pseudo.setText("Joueur" + numJoueur);
    pseudo.setHorizontalAlignment(JLabel.CENTER);
    pseudo.setBounds(3, 112, 150, 33);
    this.add(pseudo, 0);
  }
  /**
   * Creates a text field to display the directory path
   *
   * @return the text field
   */
  public JTextField createTextField() {
    JTextField text = new JTextField();
    text.setPreferredSize(favoriteDim);
    text.setMinimumSize(favoriteDim);
    text.setHorizontalAlignment(JTextField.LEFT);
    text.setEditable(true);
    text.setBackground(Color.white);
    text.setEditable(false);

    text.setInputVerifier(
        new InputVerifier() {
          public boolean verify(JComponent input) {
            return false;
          }
        });
    return text;
  }
Exemple #28
0
 public TextFieldDialog(String title, String description) {
   this.frame = new TWFrame(title);
   JTextField textField = new TWTextField();
   textField.setHorizontalAlignment(JTextField.CENTER);
   textField.setBorder(new LineBorder(new Color(200, 200, 200)));
   frame.setLayout(new BorderLayout());
   frame.add(createNorthPanel(description), BorderLayout.NORTH);
   frame.add(textField, BorderLayout.CENTER);
   frame.add(okCancelPanel, BorderLayout.SOUTH);
   frame.pack();
   frame.setLocationRelativeTo(null);
   okCancelPanel.addOKButtonAction(
       e -> {
         dialogResultListener.okButtonPushed(textField.getText());
       });
   okCancelPanel.addCancelButtonAction(e -> dialogResultListener.cancelButtonPushed());
 }
Exemple #29
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);
  }
  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()));
          }
        });
  }