コード例 #1
0
ファイル: HexEdit.java プロジェクト: khyuna/hyun
 @Override
 public void setFont(Font font) {
   FontMetrics fm = getFontMetrics(font);
   lineHeight = fm.getHeight();
   charWidth = fm.charWidth('0');
   super.setFont(font);
 }
コード例 #2
0
ファイル: AddView.java プロジェクト: AndrexGold/PhoneBook
 protected JPanel createPanelDown() {
   JPanel panel = new JPanel();
   panel.setLayout(new FlowLayout());
   panel.add(saveButton);
   panel.add(cancelButton);
   panel.setFont(new Font("Georgia", Font.CENTER_BASELINE, 15));
   return panel;
 }
コード例 #3
0
 /**
  * This method initializes panelDoctor
  *
  * @return javax.swing.JPanel
  */
 private JPanel getPanelDoctor() {
   if (panelDoctor == null) {
     lblConfirmar = new JLabel();
     lblConfirmar.setBounds(new Rectangle(29, 362, 98, 22));
     lblConfirmar.setText("Confirmar Clave:");
     lblClave = new JLabel();
     lblClave.setBounds(new Rectangle(29, 316, 82, 22));
     lblClave.setText("Clave:");
     lblUsuario = new JLabel();
     lblUsuario.setBounds(new Rectangle(29, 272, 82, 22));
     lblUsuario.setText("Usuario:");
     jLabel = new JLabel();
     jLabel.setBounds(new Rectangle(29, 226, 63, 22));
     jLabel.setText("Cedula:");
     lblCelular = new JLabel();
     lblCelular.setBounds(new Rectangle(29, 181, 63, 22));
     lblCelular.setText("Celular:");
     lblTelefono = new JLabel();
     lblTelefono.setBounds(new Rectangle(29, 135, 63, 22));
     lblTelefono.setText("Telefono:");
     lblApellido = new JLabel();
     lblApellido.setBounds(new Rectangle(29, 91, 63, 22));
     lblApellido.setText("Apellido:");
     lblNombreDoctor = new JLabel();
     lblNombreDoctor.setBounds(new Rectangle(29, 44, 63, 22));
     lblNombreDoctor.setText("Nombre:");
     panelDoctor = new JPanel();
     panelDoctor.setLayout(null);
     panelDoctor.setFont(new Font("Dialog", Font.PLAIN, 14));
     panelDoctor.setBorder(
         BorderFactory.createTitledBorder(
             BorderFactory.createLineBorder(Color.black, 1),
             "Agregar Paciente",
             TitledBorder.DEFAULT_JUSTIFICATION,
             TitledBorder.DEFAULT_POSITION,
             new Font("Dialog", Font.BOLD, 12),
             new Color(51, 51, 51)));
     panelDoctor.add(lblNombreDoctor, null);
     panelDoctor.add(getTxtNombreDoctor(), null);
     panelDoctor.add(lblApellido, null);
     panelDoctor.add(getTxtApellido(), null);
     panelDoctor.add(lblTelefono, null);
     panelDoctor.add(getTxtTelefono(), null);
     panelDoctor.add(lblCelular, null);
     panelDoctor.add(getTxtCelular(), null);
     panelDoctor.add(jLabel, null);
     panelDoctor.add(getTxtCedula(), null);
     panelDoctor.add(lblUsuario, null);
     panelDoctor.add(getTxtUsuario(), null);
     panelDoctor.add(lblClave, null);
     panelDoctor.add(lblConfirmar, null);
     panelDoctor.add(getTxtClave(), null);
     panelDoctor.add(getTxtConfirmarClave(), null);
     panelDoctor.add(getBtnAceptar(), null);
     panelDoctor.add(getBtnCancelar(), null);
   }
   return panelDoctor;
 }
コード例 #4
0
  /**
   * Sets the font property.
   *
   * @param font the new font
   */
  public void setFont(Font font) {
    super.setFont(font);

    if (dayChooser != null) {
      dayChooser.setFont(font);
      monthChooser.setFont(font);
      yearChooser.setFont(font);
    }
  }
コード例 #5
0
ファイル: TestHTML.java プロジェクト: maeyler/PlainJava
  public TestHTML() {
    int d = (Frame.getFrames().length == 0) ? JFrame.EXIT_ON_CLOSE : JFrame.DISPOSE_ON_CLOSE;

    JPanel pan = new JPanel();
    pan.setLayout(new BorderLayout(GAP, GAP - 4));
    pan.setBorder(new EmptyBorder(GAP, GAP, GAP, GAP));
    pan.setBackground(COL);
    pan.setFont(font);
    lab = new JLabel(MSG); // , SwingConstants.CENTER);
    lab.setName("title");
    lab.setFont(new Font("Serif", 3, 16));
    // lab.setForeground(Color.black);
    pan.add(lab, "North");

    text = new JTextArea("JTextArea\n");
    text.setName("area");
    text.setLineWrap(true);
    text.setFont(font);
    JScrollPane scr1 = new JScrollPane(text);
    scr1.setPreferredSize(new Dimension(300, 500));
    pan.add(scr1, "Center");

    html = new JEditorPane();
    html.setContentType("text/html");
    html.setEditable(false);
    html.addMouseListener(this);
    html.addMouseMotionListener(this);
    JScrollPane scr2 = new JScrollPane(html);
    scr2.setPreferredSize(new Dimension(350, 500));
    pan.add(scr2, "East");

    but = new JButton("Copy text from JTextArea to JEditorPane");
    but.addActionListener(this);
    pan.add(but, "South");

    frm = new JFrame(MSG);
    frm.setContentPane(pan);
    frm.setDefaultCloseOperation(d);
    frm.setLocation(100, 150);
    frm.pack();
    frm.setVisible(true);
  }
コード例 #6
0
 /**
  * This method initializes panelRecord
  *
  * @return javax.swing.JPanel
  */
 private JPanel getPanelRecord() {
   if (panelRecord == null) {
     lblTelefonoContacto = new JLabel();
     lblTelefonoContacto.setBounds(new Rectangle(29, 407, 129, 23));
     lblTelefonoContacto.setText("Telefono de Contacto:");
     lblNombreContacto = new JLabel();
     lblNombreContacto.setBounds(new Rectangle(29, 361, 129, 23));
     lblNombreContacto.setText("Nombre de Contacto:");
     lblCirujias = new JLabel();
     lblCirujias.setBounds(new Rectangle(29, 226, 94, 22));
     lblCirujias.setText("Cirujias:");
     lblAlergias = new JLabel();
     lblAlergias.setBounds(new Rectangle(29, 90, 94, 22));
     lblAlergias.setText("Alergias:");
     lblTipoSangre = new JLabel();
     lblTipoSangre.setBounds(new Rectangle(29, 44, 94, 22));
     lblTipoSangre.setText("Tipo de Sangre:");
     panelRecord = new JPanel();
     panelRecord.setLayout(null);
     panelRecord.setBorder(
         BorderFactory.createTitledBorder(
             BorderFactory.createLineBorder(Color.black, 1),
             "Record Medico",
             TitledBorder.DEFAULT_JUSTIFICATION,
             TitledBorder.DEFAULT_POSITION,
             new Font("Dialog", Font.BOLD, 12),
             new Color(51, 51, 51)));
     panelRecord.setFont(new Font("Dialog", Font.PLAIN, 14));
     panelRecord.add(lblTipoSangre, null);
     panelRecord.add(getCmbTipoSangre(), null);
     panelRecord.add(lblAlergias, null);
     panelRecord.add(getTxtAlergias(), null);
     panelRecord.add(lblCirujias, null);
     panelRecord.add(getTxtCirujias(), null);
     panelRecord.add(lblNombreContacto, null);
     panelRecord.add(getTxtNombreContacto(), null);
     panelRecord.add(lblTelefonoContacto, null);
     panelRecord.add(getTxtTelefonoContacto(), null);
   }
   return panelRecord;
 }
コード例 #7
0
  public OptionsDatabasePanel() {
    super();
    setName(NAME);

    setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));

    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBorder(new EmptyBorder(2, 2, 2, 2));

    GridBagConstraints gbc = new GridBagConstraints();

    panel.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11));

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new java.awt.Insets(2, 2, 2, 2);
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(getCheckBoxCompactDatabase(), gbc);

    add(panel);
  }
コード例 #8
0
  /**
   * This constructor sets up much of the functionality of the GUI, including the actual layout of
   * the components of the GUI, as well as handling the graph implementation.
   */
  public MainWindow(Iterable<Document> corp) {

    corpus = corp;
    corpusIndex = corpus.iterator();
    doc = corpusIndex.next();
    /*
     * GUI Layout Creation
     */

    // create the OverviewPanel which shows a reduced size snapshot of the entire graph
    predictionPanel = new PredictionListPanel(this);
    predictionPanel.setFont(font);
    tvPanel = new TextViewPanel(this);
    tvPanel.setFont(font);

    textSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, predictionPanel, tvPanel);
    textSplitPane.setDividerLocation(300);

    buttonPanel = createForwardBackPanel(doc);
    buttonPanel.setFont(font);
    editPanel = new PredictionEditPanel(this);
    editPanel.setFont(font);

    JSplitPane bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editPanel, buttonPanel);
    bottomSplitPane.setDividerLocation(120);
    mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, textSplitPane, bottomSplitPane);
    mainSplitPane.setDividerLocation(700);

    getContentPane().add(mainSplitPane);
    // splitPane1.setDividerLocation(0.8);
    this.setTitle("Prediction Viewer");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    displayRawText();
    pack();
    setSize(1200, 900);
    setVisible(true);
  }
コード例 #9
0
ファイル: DataPanel.java プロジェクト: Serabe/geogebra
  public void setFont(Font font) {
    super.setFont(font);

    if (dataTable != null && dataTable.getRowCount() > 0 && dataTable.getColumnCount() > 0) {

      // set the font for each component
      dataTable.setFont(font);
      if (dataTable.getTableHeader() != null) dataTable.getTableHeader().setFont(font);
      rowHeader.setFont(font);

      // get row height needed to draw an "X" character
      int h =
          dataTable
              .getCellRenderer(0, 0)
              .getTableCellRendererComponent(dataTable, "X", false, false, 0, 0)
              .getPreferredSize()
              .height;

      // use this height to set the table and row header heights
      dataTable.setRowHeight(h);
      rowHeader.setFixedCellHeight(h);

      // set the column width
      int size = font.getSize();
      if (size < 12) size = 12; // minimum size
      double multiplier = (size) / 12.0;
      preferredColumnWidth = (int) (SpreadsheetSettings.TABLE_CELL_WIDTH * multiplier);

      // columnHeader.setPreferredSize(new Dimension(preferredColumnWidth,
      // (int)(MyTable.TABLE_CELL_HEIGHT * multiplier)));
      // this.validate();
      // dataTable.repaint();
    }

    if (dataTable != null)
      dataTable.setPreferredScrollableViewportSize(dataTable.getPreferredSize());
  }
コード例 #10
0
 /** {@inheritDoc} */
 @Override
 public Component getListCellRendererComponent(
     JList<? extends TradeRouteStop> list,
     TradeRouteStop value,
     int index,
     boolean isSelected,
     boolean hasFocus) {
   JPanel panel = (isSelected) ? SELECTED_COMPONENT : NORMAL_COMPONENT;
   panel.removeAll();
   panel.setForeground(list.getForeground());
   panel.setFont(list.getFont());
   Location location = value.getLocation();
   ImageLibrary lib = getImageLibrary();
   JLabel icon, name;
   if (location instanceof Europe) {
     Europe europe = (Europe) location;
     Image image = lib.getSmallerMiscIconImage(europe.getOwner().getNation());
     icon = new JLabel(new ImageIcon(image));
     name = Utility.localizedLabel(europe);
   } else if (location instanceof Colony) {
     Colony colony = (Colony) location;
     icon =
         new JLabel(
             new ImageIcon(
                 ImageLibrary.getSettlementImage(colony, lib.getScaleFactor() * 0.5f)));
     name = new JLabel(colony.getName());
   } else {
     throw new IllegalStateException("Bogus location: " + location);
   }
   panel.add(icon, "spany");
   panel.add(name, "span, wrap");
   for (GoodsType cargo : value.getCargo()) {
     panel.add(new JLabel(new ImageIcon(lib.getSmallerIconImage(cargo))));
   }
   return panel;
 }
コード例 #11
0
  private JPanel getWeekAndDayPanal() {
    String colname[] = {"日", "一", "二", "三", "四", "五", "六"};
    JPanel result = new JPanel();
    // 设置固定字体,以免调用环境改变影响界面美观
    result.setFont(new Font("宋体", Font.PLAIN, 12));
    result.setLayout(new GridLayout(7, 7));
    result.setBackground(Color.white);
    JLabel cell;

    for (int i = 0; i < 7; i++) {
      cell = new JLabel(colname[i]);
      cell.setHorizontalAlignment(JLabel.RIGHT);
      if (i == 0 || i == 6) cell.setForeground(weekendFontColor);
      else cell.setForeground(weekFontColor);
      result.add(cell);
    }

    int actionCommandId = 0;
    for (int i = 0; i < 6; i++)
      for (int j = 0; j < 7; j++) {
        JButton numberButton = new JButton();
        numberButton.setBorder(null);
        numberButton.setHorizontalAlignment(SwingConstants.RIGHT);
        numberButton.setActionCommand(String.valueOf(actionCommandId));
        numberButton.addActionListener(this);
        numberButton.setBackground(palletTableColor);
        numberButton.setForeground(dateFontColor);
        if (j == 0 || j == 6) numberButton.setForeground(weekendFontColor);
        else numberButton.setForeground(dateFontColor);
        daysButton[i][j] = numberButton;
        result.add(numberButton);
        actionCommandId++;
      }

    return result;
  }
コード例 #12
0
ファイル: StatusArea.java プロジェクト: tbsalling/EPD
  /**
   * Constructor for setting up the status area
   *
   * @param mainFrame reference to the mainframe
   */
  public StatusArea(MainFrame mainFrame) {

    // Setup location
    this.setLocation(10 + moveHandlerHeight, 80 + mainFrame.getToolbar().getHeight());
    this.setVisible(true);
    this.setResizable(false);

    // Strip off window looks
    setRootPaneCheckingEnabled(false);
    ((javax.swing.plaf.basic.BasicInternalFrameUI) this.getUI()).setNorthPane(null);
    this.setBorder(null);

    // Create the top movehandler (for dragging)
    moveHandler = new JPanel(new BorderLayout());
    moveHandler.add(new JLabel("Status", SwingConstants.CENTER), BorderLayout.CENTER);

    moveHandler.setForeground(new Color(200, 200, 200));
    moveHandler.setOpaque(true);
    moveHandler.setBackground(Color.DARK_GRAY);
    moveHandler.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(30, 30, 30)));
    moveHandler.setFont(new Font("Arial", Font.BOLD, 9));
    moveHandler.setPreferredSize(new Dimension(statusItemWidth, moveHandlerHeight));
    ToolbarMoveMouseListener mml = new ToolbarMoveMouseListener(this, mainFrame);
    moveHandler.addMouseListener(mml);
    moveHandler.addMouseMotionListener(mml);

    JLabel close = new JLabel(EPDShore.res().getCachedImageIcon("images/window/close.png"));
    close.addMouseListener(
        new MouseAdapter() {
          public void mouseReleased(MouseEvent e) {
            setVisible(false);
          }
        });
    close.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    moveHandler.add(close, BorderLayout.EAST);

    // Create the grid for the status items
    statusPanel = new JPanel();
    statusPanel.setLayout(new GridLayout(0, 1));
    statusPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0));
    statusPanel.setBackground(new Color(83, 83, 83));

    // Add status items here
    // Status: X coordinate
    statusItems.put("LAT", new JLabel(" LAT: N/A"));

    // Status: Y coordinate
    statusItems.put("LON", new JLabel(" LON: N/A"));

    // Create the grid for the highlighted ship info area
    highlightPanel = new JPanel();
    highlightPanel.setLayout(new GridLayout(0, 1));
    highlightPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0));
    highlightPanel.setBackground(new Color(83, 83, 83));

    // Create the masterpanel for aligning
    masterPanel = new JPanel(new BorderLayout());
    masterPanel.add(moveHandler, BorderLayout.NORTH);
    masterPanel.add(statusPanel, BorderLayout.CENTER);
    masterPanel.add(highlightPanel, BorderLayout.SOUTH);
    masterPanel.setBorder(
        BorderFactory.createEtchedBorder(
            EtchedBorder.LOWERED, new Color(30, 30, 30), new Color(45, 45, 45)));
    this.getContentPane().add(masterPanel);

    // And finally refresh the status bar
    repaintToolbar();
  }
コード例 #13
0
ファイル: VizieRPanel.java プロジェクト: jankotek/asterope
  /**
   * Manage the associated panels design
   *
   * @param withparam
   * @param target
   * @param radius
   * @param rows
   */
  protected void makeForm(boolean withparam, String target, String radius, int rows) {
    JPanel byword = null; // keyword panel
    JPanel fields = null; // fields panel
    JPanel parameters = null; // parameters panel
    JPanel lll = null; // 3 lists panel
    JPanel actions = null; // action panel
    int i;

    GridBagConstraints c = new GridBagConstraints();

    // Form title setting
    titre = new MyLabel(DEFAULT_TITRE, Label.CENTER, PLAIN);
    titre.setBackground(Aladin.BLUE);
    fields = new JPanel();
    fields.setLayout(new BorderLayout(3, 3));

    byword = new JPanel();
    byword.setBackground(Aladin.BLUE);
    byword.setLayout(new BorderLayout(3, 3));
    byword.setFont(BOLD);

    // Construction
    // title panel and keyword query panel
    JPanel haut = new JPanel();
    haut.setBackground(Aladin.BLUE);
    haut.setLayout(new BorderLayout(3, 3));

    // Free keyword interrogation panel (author...)
    makeAdd(byword, new JLabel(KEYWORD), "West");
    makeAdd(byword, tauthor, "Center");

    // Window components are depending on
    if ((target == null && radius == null)) {

      // Target panel construction
      parameters = new JPanel();
      GridBagLayout gridbag = new GridBagLayout();

      parameters.setLayout(gridbag);
      parameters.setFont(BOLD);

      JLabel label = new JLabel("Target ");
      c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.SOUTH;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(label, c);
      parameters.add(label);

      // Target field
      c = new GridBagConstraints();
      c.gridx = 2;
      c.gridy = 0;
      c.gridwidth = 4;
      c.weightx = 1;
      c.weighty = 0.1;
      c.ipadx = 50;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(ttarget, c);
      parameters.add(ttarget);

      // Create and fill coordinate popup
      coordinate = new JComboBox();
      coordinate.addItem("today");
      coordinate.addItem("J2000");
      coordinate.addItem("B1975");
      coordinate.addItem("B1950");
      coordinate.addItem("B1900");
      coordinate.addItem("B1875");
      coordinate.addItem("B1855");
      coordinate.addItem("Galactic");
      coordinate.addItem("Supergal.");
      coordinate.setSelectedItem("J2000");

      // Coordinate field
      c = new GridBagConstraints();
      c.gridx = 6;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(coordinate, c);
      parameters.add(coordinate);

      // Radius label
      label = new JLabel("Radius ");
      c = new GridBagConstraints();
      c.gridx = 8;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.SOUTH;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(label, c);
      parameters.add(label);

      // Radius field
      c = new GridBagConstraints();
      c.gridx = 10;
      c.gridy = 0;
      c.gridwidth = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(tradius, c);
      parameters.add(tradius);
      tradius.setText("10.0"); // default value

      // Radius panel construction
      unit = new JComboBox();
      unit.addItem("deg");
      unit.addItem(ARCMIN);
      unit.addItem(ARCSEC);

      // Set default unit to arcmin
      unit.setSelectedItem(ARCMIN);
      c = new GridBagConstraints();
      c.gridx = 11;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(unit, c);
      parameters.add(unit);
    } else {
      if (radius != null) tradius.setText(radius);
      if (target != null) ttarget.setText(target);
    }

    // Keywords section panel construction
    lll = new JPanel();

    GridBagLayout gridbag = new GridBagLayout();
    lll.setLayout(gridbag);
    lll.setFont(BOLD);
    lll.setBackground(Aladin.BLUE);
    c = new GridBagConstraints();

    lk = new JList[nSection];
    JLabel label = null;
    for (int j = 0; j < nSection; j++) {
      label = new JLabel();
      c = new GridBagConstraints();
      c.gridx = j;
      c.gridy = 0;
      c.gridwidth = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.SOUTH;
      c.insets = new Insets(0, 0, 0, 0);
      gridbag.setConstraints(label, c);
      label.setText(getSectionName((String) vq.getNameKey().elementAt(j)));

      lll.add(label);

      Vector v = (Vector) vq.gethKey().get(vq.getNameKey().elementAt(j));
      if (rows < 0) lk[j] = new JList(v);
      else {
        lk[j] = new JList(v);
        lk[j].setVisibleRowCount(rows);
        lk[j].setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
      }
      //      Enumeration e = v.elements();
      //      while( e.hasMoreElements() )
      //        lk[j].addItem((String)e.nextElement());
      c = new GridBagConstraints();
      c.gridx = j;
      c.gridy = 1;
      c.gridwidth = 1;
      c.weightx = 1;
      c.weighty = 1;
      c.fill = GridBagConstraints.BOTH;
      c.insets = new Insets(0, 2, 0, 2);

      JScrollPane jp = new JScrollPane(lk[j]);
      gridbag.setConstraints(jp, c);
      lll.add(jp);
    }

    // Change to a GridBagLayout to have non equal lists

    // Action button panel construction
    actions = new JPanel();
    actions.setBackground(Aladin.BLUE);
    actions.setLayout(new FlowLayout(FlowLayout.RIGHT));
    actions.setFont(BOLD);

    makeAdd(haut, titre, "North");
    makeAdd(haut, byword, "Center");
    if ((target == null && radius == null) && withparam == true) makeAdd(haut, parameters, "South");

    // List and action panel
    JPanel bas = new JPanel();
    bas.setBackground(Aladin.BLUE);
    bas.setLayout(new BorderLayout(3, 3));
    makeAdd(bas, lll, "Center");
    makeAdd(bas, actions, "South");

    // Previous panels are added to the main frame
    makeAdd(this, haut, "North");
    makeAdd(this, bas, "Center");

    setTitre(this.target);
  }
コード例 #14
0
 public InsertPeopleDialog() {
   getContentPane().setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
   setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
   setUndecorated(true);
   setModalityType(ModalityType.APPLICATION_MODAL);
   setTitle("Insert");
   setType(Type.UTILITY);
   setResizable(false);
   try {
     peopleDAO = new PeopleDAO();
   } catch (Exception exc) {
     JOptionPane.showMessageDialog(
         clientWindow, "Something went wrong!\n" + exc, "Error!", JOptionPane.ERROR_MESSAGE);
     exc.printStackTrace();
   }
   setBounds(550, 353, 290, 105);
   getContentPane().setLayout(new BorderLayout());
   contentPanel.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
   contentPanel.setBackground(new Color(169, 169, 169));
   contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
   getContentPane().add(contentPanel, BorderLayout.CENTER);
   contentPanel.setLayout(null);
   {
     JLabel lblFirstName = new JLabel("First Name");
     lblFirstName.setBounds(5, 9, 75, 15);
     lblFirstName.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
     lblFirstName.setForeground(Color.BLACK);
     contentPanel.add(lblFirstName);
   }
   {
     firstNameTextField = new JTextField();
     firstNameTextField.setBounds(85, 3, 200, 27);
     firstNameTextField.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
     contentPanel.add(firstNameTextField);
     firstNameTextField.setColumns(10);
   }
   {
     JLabel lblLastName = new JLabel("Last Name");
     lblLastName.setBounds(8, 41, 72, 15);
     lblLastName.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
     lblLastName.setForeground(Color.BLACK);
     contentPanel.add(lblLastName);
   }
   {
     lastNameTextField = new JTextField();
     lastNameTextField.setBounds(85, 35, 200, 27);
     lastNameTextField.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
     contentPanel.add(lastNameTextField);
     lastNameTextField.setColumns(10);
   }
   {
     JPanel buttonPane = new JPanel();
     buttonPane.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
     buttonPane.setBackground(Color.GRAY);
     buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
     getContentPane().add(buttonPane, BorderLayout.SOUTH);
     {
       JButton okButton = new JButton("OK");
       okButton.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
       okButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent e) {
               if (firstNameTextField.getText().equals("")
                   && lastNameTextField.getText().equals("")) {
                 JOptionPane.showMessageDialog(
                     clientWindow, "Can't be null", "Error!", JOptionPane.ERROR_MESSAGE);
                 return;
               }
               savePeople();
             }
           });
       okButton.setActionCommand("OK");
       buttonPane.add(okButton);
       getRootPane().setDefaultButton(okButton);
     }
     {
       JButton cancelButton = new JButton("Cancel");
       cancelButton.setFont(new Font("Copperplate Gothic Light", Font.PLAIN, 13));
       cancelButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent e) {
               setVisible(false);
               dispose();
             }
           });
       cancelButton.setActionCommand("Cancel");
       buttonPane.add(cancelButton);
     }
   }
 }
コード例 #15
0
  public Reflexology2() {
    frame.setSize(615, 455);
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("Reflexology 2.0");
    frame.setResizable(false);

    frame2.setSize(600, 475);
    frame2.setLocationRelativeTo(null);
    frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame2.setTitle("Reflexology 2.0");
    frame2.setResizable(false);

    frame3.setSize(600, 475);
    frame3.setLocationRelativeTo(null);
    frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame3.setTitle("Reflexology Survey");
    frame3.setResizable(false);

    button1 = new JButton("Accept");
    button2 = new JButton("Decline");
    // movingButton = new JButton("Click Me");

    ListenForAcceptButton lForAButton = new ListenForAcceptButton();
    ListenForDeclineButton lForDButton = new ListenForDeclineButton();
    button1.addActionListener(lForAButton);
    button2.addActionListener(lForDButton);
    // movingButton.addActionListener(lForMButton);

    textArea1.setText("Tracking Events\n");
    textArea1.setLineWrap(true);
    textArea1.setWrapStyleWord(true);
    textArea1.setSize(15, 50);
    textArea1.setEditable(false);

    FileReader reader = null;
    try {
      reader = new FileReader("EULA.txt");
      textArea1.read(reader, "EULA.txt");
    } catch (IOException exception) {
      System.err.println("Problem loading file");
      exception.printStackTrace();
    } finally {
      if (reader != null) {
        try {
          reader.close();
        } catch (IOException exception) {
          System.err.println("Error closing reader");
          exception.printStackTrace();
        }
      }
    }

    AdjustmentListener sListener = new MyAdjustmentListener();
    scrollBar1.getVerticalScrollBar().addAdjustmentListener(sListener);

    thePanel.add(scrollBar1);
    button1.setEnabled(false);
    thePanel.add(button1);
    thePanel.add(button2);

    frame.add(thePanel);
    ListenForMouse lForMouse = new ListenForMouse();
    thePlacebo.addMouseListener(lForMouse);
    label1.setFont(font);
    thePlacebo.add(label1);
    frame2.add(thePlacebo);

    ListenForWindow lForWindow = new ListenForWindow();
    frame.addWindowListener(lForWindow);
    frame2.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyChar() == 'X' || e.getKeyChar() == 'x') {
              moveBallTimer.start();
            }
          }
        });
    frame.setVisible(true);

    moveBallTimer =
        new Timer(
            900,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                moveBall();
                //  System.out.println("Timer started!");
                repaint();
              }
            });

    addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (frame2.isVisible()) {
              moveBallTimer.start();
            }
          }
        });

    setFont(new Font("Tahoma", Font.PLAIN, 11));
    panelSurv1.setFont(new Font("Tahoma", Font.PLAIN, 11));
    frame3.getContentPane().setLayout(new CardLayout(0, 0));
    frame3.getContentPane().add(panelSurv1, "");
    panelSurv1.setLayout(null);

    /*
    frame3.setVisible(true);
    frame3.setSize(600, 475);
    frame3.setResizable(false);
    frame3.setLocationRelativeTo(null);
    frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    */

    JLabel lblNewLabel = new JLabel("How old are you?");
    lblNewLabel.setBounds(22, 26, 112, 14);
    panelSurv1.add(lblNewLabel);

    JLabel lblNewLabel_1 = new JLabel("Select your gender:");
    lblNewLabel_1.setBounds(366, 37, 115, 14);
    panelSurv1.add(lblNewLabel_1);

    JLabel lblNewLabel_2 = new JLabel("Current class level:");
    lblNewLabel_2.setBounds(22, 56, 112, 14);
    panelSurv1.add(lblNewLabel_2);

    String[] classLevel = {
      "", "Freshman", "Sophomore", "Junior", "Senior", "Senior+", "Graduate Student", "Other"
    };
    cmbClass = new JComboBox(classLevel);
    cmbClass.setName("");
    cmbClass.setBounds(144, 53, 195, 20);
    panelSurv1.add(cmbClass);

    JLabel lblWhatIsYour = new JLabel("What is your major or field?");
    lblWhatIsYour.setBounds(22, 102, 161, 14);
    panelSurv1.add(lblWhatIsYour);

    txtMajor = new JTextField();
    txtMajor.setName("");
    txtMajor.setColumns(10);
    txtMajor.setBounds(193, 99, 347, 20);
    panelSurv1.add(txtMajor);

    JLabel lblDidYouRead =
        new JLabel("Did you read the license agreement before installing Reflexology?");
    lblDidYouRead.setBounds(22, 143, 392, 14);
    panelSurv1.add(lblDidYouRead);

    JLabel lblIfTheLicensing =
        new JLabel(
            "If the licensing agreement raised any privacy concerns, please type them below:");
    lblIfTheLicensing.setBounds(22, 178, 503, 14);
    panelSurv1.add(lblIfTheLicensing);

    JLabel lblToHowMany = new JLabel("Up to how many friends may you gift Reflexology?");
    lblToHowMany.setBounds(22, 247, 303, 14);
    panelSurv1.add(lblToHowMany);

    String[] numGifts = {"", "Don't know", "0", "1", "2", "3", "4"};
    cmbNumGifts = new JComboBox(numGifts);
    cmbNumGifts.setBounds(320, 244, 205, 20);
    panelSurv1.add(cmbNumGifts);

    JLabel lblReflexologyProvidesThe = new JLabel("Reflexology provides the following warranty:");
    lblReflexologyProvidesThe.setBounds(22, 280, 254, 14);
    panelSurv1.add(lblReflexologyProvidesThe);

    String[] theWarranty = {
      "",
      "Don't know",
      "Won't harm my computer",
      "Doesn't have viruses",
      "Money back guarantee",
      "None"
    };
    cmbWarranty = new JComboBox(theWarranty);
    cmbWarranty.setBounds(296, 277, 157, 20);
    panelSurv1.add(cmbWarranty);

    JLabel lblWhoOwnsIntellectual =
        new JLabel("Who owns intellectual property created with Reflexology?");
    lblWhoOwnsIntellectual.setBounds(22, 316, 372, 14);
    panelSurv1.add(lblWhoOwnsIntellectual);

    String[] IPOwner = {
      "", "Don't know", "Me", "The researchers", "Penn State", "Reflexology programmers"
    };
    cmbIPOwner = new JComboBox(IPOwner);
    cmbIPOwner.setBounds(408, 313, 157, 20);
    panelSurv1.add(cmbIPOwner);

    btnPage2.setBounds(340, 400, 89, 23);
    panelSurv1.add(btnPage2);

    JLabel lblNewLabel_3 = new JLabel("*WARNING* You cannot return to these answers.");
    lblNewLabel_3.setForeground(Color.RED);
    lblNewLabel_3.setBounds(35, 404, 277, 14);
    panelSurv1.add(lblNewLabel_3);

    String[] gender = {"", "M", "F"};
    cmbGender = new JComboBox(gender);
    cmbGender.setBounds(491, 34, 70, 20);
    panelSurv1.add(cmbGender);

    String[] didRead = {"", "Yes", "No"};
    cmbDidRead = new JComboBox(didRead);
    cmbDidRead.setBounds(424, 140, 98, 20);
    panelSurv1.add(cmbDidRead);

    spnAge = new JSpinner();
    spnAge.setModel(new SpinnerNumberModel(1, 1, 111, 1));
    spnAge.setBounds(148, 23, 47, 20);
    panelSurv1.add(spnAge);

    txtPrivacyConcerns = new JTextField();
    txtPrivacyConcerns.setName("");
    txtPrivacyConcerns.setColumns(10);
    txtPrivacyConcerns.setBounds(22, 204, 547, 23);
    panelSurv1.add(txtPrivacyConcerns);

    frame3.getContentPane().add(panelSurv2, "");
    panelSurv2.setLayout(null);

    JLabel lblNewLabel_4 =
        new JLabel("Estimate your overall comprehension of the License Agreement:");
    lblNewLabel_4.setBounds(20, 18, 386, 14);
    panelSurv2.add(lblNewLabel_4);

    sldComp = new JSlider();
    sldComp.setMajorTickSpacing(1);
    sldComp.setPaintTicks(true);
    sldComp.setPaintLabels(true);
    sldComp.setSnapToTicks(true);
    sldComp.setValue(-1);
    sldComp.setMinorTickSpacing(1);
    sldComp.setMinimum(1);
    sldComp.setMaximum(5);
    sldComp.setBounds(154, 43, 274, 45);
    panelSurv2.add(sldComp);

    JLabel lblNewLabel_5 = new JLabel("No comprehension");
    lblNewLabel_5.setHorizontalAlignment(SwingConstants.RIGHT);
    lblNewLabel_5.setBounds(20, 43, 124, 25);
    panelSurv2.add(lblNewLabel_5);

    JLabel lblNewLabel_6 = new JLabel("Perfect Comprehension");
    lblNewLabel_6.setBounds(438, 43, 138, 25);
    panelSurv2.add(lblNewLabel_6);

    JLabel lblIEnjoyUsing = new JLabel("I enjoy using technological applications (apps):");
    lblIEnjoyUsing.setBounds(20, 99, 386, 14);
    panelSurv2.add(lblIEnjoyUsing);

    JLabel lblStronglyDisagree = new JLabel("Strongly disagree");
    lblStronglyDisagree.setHorizontalAlignment(SwingConstants.RIGHT);
    lblStronglyDisagree.setBounds(20, 124, 124, 25);
    panelSurv2.add(lblStronglyDisagree);

    sldEnjoyTech = new JSlider();
    sldEnjoyTech.setValue(-1);
    sldEnjoyTech.setSnapToTicks(true);
    sldEnjoyTech.setPaintTicks(true);
    sldEnjoyTech.setPaintLabels(true);
    sldEnjoyTech.setMinorTickSpacing(1);
    sldEnjoyTech.setMinimum(1);
    sldEnjoyTech.setMaximum(5);
    sldEnjoyTech.setMajorTickSpacing(1);
    sldEnjoyTech.setBounds(154, 124, 274, 45);
    panelSurv2.add(sldEnjoyTech);

    JLabel lblStronglyAgree = new JLabel("Strongly agree");
    lblStronglyAgree.setBounds(438, 124, 138, 25);
    panelSurv2.add(lblStronglyAgree);

    JLabel lblIAmGood = new JLabel("I am good at using technological applications (apps):");
    lblIAmGood.setBounds(20, 180, 386, 14);
    panelSurv2.add(lblIAmGood);

    sldUseTech = new JSlider();
    sldUseTech.setValue(-1);
    sldUseTech.setSnapToTicks(true);
    sldUseTech.setPaintTicks(true);
    sldUseTech.setPaintLabels(true);
    sldUseTech.setMinorTickSpacing(1);
    sldUseTech.setMinimum(1);
    sldUseTech.setMaximum(5);
    sldUseTech.setMajorTickSpacing(1);
    sldUseTech.setBounds(154, 205, 274, 45);
    panelSurv2.add(sldUseTech);

    JLabel lblHowOftenDo = new JLabel("My friends ask me for computer and technology advice:");
    lblHowOftenDo.setBounds(20, 261, 386, 14);
    panelSurv2.add(lblHowOftenDo);

    sldFriendsTech = new JSlider();
    sldFriendsTech.setValue(-1);
    sldFriendsTech.setSnapToTicks(true);
    sldFriendsTech.setPaintTicks(true);
    sldFriendsTech.setPaintLabels(true);
    sldFriendsTech.setMinorTickSpacing(1);
    sldFriendsTech.setMinimum(1);
    sldFriendsTech.setMaximum(5);
    sldFriendsTech.setMajorTickSpacing(1);
    sldFriendsTech.setBounds(154, 286, 274, 45);
    panelSurv2.add(sldFriendsTech);

    JLabel label_1 = new JLabel("Strongly disagree");
    label_1.setHorizontalAlignment(SwingConstants.RIGHT);
    label_1.setBounds(20, 205, 124, 25);
    panelSurv2.add(label_1);

    JLabel label_2 = new JLabel("Strongly disagree");
    label_2.setHorizontalAlignment(SwingConstants.RIGHT);
    label_2.setBounds(20, 286, 124, 25);
    panelSurv2.add(label_2);

    JLabel label_3 = new JLabel("Strongly agree");
    label_3.setBounds(438, 205, 138, 25);
    panelSurv2.add(label_3);

    JLabel label_4 = new JLabel("Strongly agree");
    label_4.setBounds(438, 286, 138, 25);
    panelSurv2.add(label_4);

    JLabel label_5 = new JLabel("*WARNING* You cannot return to these answers.");
    label_5.setForeground(Color.RED);
    label_5.setBounds(80, 382, 277, 14);
    panelSurv2.add(label_5);

    btnPage3.setBounds(385, 378, 89, 23);
    panelSurv2.add(btnPage3);

    frame3.getContentPane().add(panelSurv3, "");
    panelSurv3.setLayout(null);

    JLabel lblNewLabel_7 = new JLabel("Is there anything you enjoyed about the license agreement?");
    lblNewLabel_7.setBounds(10, 11, 349, 14);
    panelSurv3.add(lblNewLabel_7);

    txtEnjoyedLic = new JTextField();
    txtEnjoyedLic.setBounds(364, 8, 220, 20);
    panelSurv3.add(txtEnjoyedLic);
    txtEnjoyedLic.setColumns(10);

    JLabel lblNewLabel_8 =
        new JLabel("When you install reflexology, who are you entering an agreement with?");
    lblNewLabel_8.setBounds(10, 36, 412, 14);
    panelSurv3.add(lblNewLabel_8);

    String[] whoAgree = {
      "",
      "Don't know",
      "State of PA",
      "Penn State",
      "PA Court of Common Pleas",
      "PA District Court",
      "Reflexology Development Team"
    };
    cmbWhoAgree = new JComboBox(whoAgree);
    cmbWhoAgree.setBounds(432, 33, 152, 20);
    panelSurv3.add(cmbWhoAgree);

    JLabel lblTheLicenseAgreement =
        new JLabel("The license agreement applies to the following types of media:");
    lblTheLicenseAgreement.setBounds(10, 61, 368, 14);
    panelSurv3.add(lblTheLicenseAgreement);

    String[] mediaTypes = {
      "",
      "Don't know",
      "Software",
      "Digital Media Content",
      "Print Material",
      "Documentation",
      "All of the above"
    };
    cmbMediaTypes = new JComboBox(mediaTypes);
    cmbMediaTypes.setBounds(388, 61, 196, 20);
    panelSurv3.add(cmbMediaTypes);

    JLabel lblNewLabel_9 =
        new JLabel("Is it possible to purchase the Reflexology software? (explain below)");
    lblNewLabel_9.setBounds(10, 86, 566, 14);
    panelSurv3.add(lblNewLabel_9);

    txtPurchasing = new JTextField();
    txtPurchasing.setBounds(10, 111, 574, 20);
    panelSurv3.add(txtPurchasing);
    txtPurchasing.setColumns(10);

    JLabel lblTheLicenseAgreement_1 = new JLabel("The license agreement was visually appealing");
    lblTheLicenseAgreement_1.setBounds(20, 145, 386, 14);
    panelSurv3.add(lblTheLicenseAgreement_1);

    JLabel label_7 = new JLabel("Strongly disagree");
    label_7.setHorizontalAlignment(SwingConstants.RIGHT);
    label_7.setBounds(20, 170, 124, 25);
    panelSurv3.add(label_7);

    sldAesthetics = new JSlider();
    sldAesthetics.setValue(-1);
    sldAesthetics.setSnapToTicks(true);
    sldAesthetics.setPaintTicks(true);
    sldAesthetics.setPaintLabels(true);
    sldAesthetics.setMinorTickSpacing(1);
    sldAesthetics.setMinimum(1);
    sldAesthetics.setMaximum(5);
    sldAesthetics.setMajorTickSpacing(1);
    sldAesthetics.setBounds(154, 170, 274, 45);
    panelSurv3.add(sldAesthetics);

    JLabel label_8 = new JLabel("Strongly agree");
    label_8.setBounds(438, 170, 138, 25);
    panelSurv3.add(label_8);

    JLabel lblTheTextOf = new JLabel("This  license agreement was easy to understand");
    lblTheTextOf.setBounds(20, 226, 463, 14);
    panelSurv3.add(lblTheTextOf);

    JLabel label_10 = new JLabel("Strongly disagree");
    label_10.setHorizontalAlignment(SwingConstants.RIGHT);
    label_10.setBounds(20, 251, 124, 25);
    panelSurv3.add(label_10);

    sldUnderstandLic = new JSlider();
    sldUnderstandLic.setValue(-1);
    sldUnderstandLic.setSnapToTicks(true);
    sldUnderstandLic.setPaintTicks(true);
    sldUnderstandLic.setPaintLabels(true);
    sldUnderstandLic.setMinorTickSpacing(1);
    sldUnderstandLic.setMinimum(1);
    sldUnderstandLic.setMaximum(5);
    sldUnderstandLic.setMajorTickSpacing(1);
    sldUnderstandLic.setBounds(154, 251, 274, 45);
    panelSurv3.add(sldUnderstandLic);

    JLabel label_11 = new JLabel("Strongly agree");
    label_11.setBounds(438, 251, 138, 25);
    panelSurv3.add(label_11);

    JLabel label_6 = new JLabel("Strongly disagree");
    label_6.setHorizontalAlignment(SwingConstants.RIGHT);
    label_6.setBounds(20, 332, 124, 25);
    panelSurv3.add(label_6);

    sldAnnoyed = new JSlider();
    sldAnnoyed.setValue(-1);
    sldAnnoyed.setSnapToTicks(true);
    sldAnnoyed.setPaintTicks(true);
    sldAnnoyed.setPaintLabels(true);
    sldAnnoyed.setMinorTickSpacing(1);
    sldAnnoyed.setMinimum(1);
    sldAnnoyed.setMaximum(5);
    sldAnnoyed.setMajorTickSpacing(1);
    sldAnnoyed.setBounds(154, 332, 274, 45);
    panelSurv3.add(sldAnnoyed);

    JLabel label_9 = new JLabel("Strongly agree");
    label_9.setBounds(438, 332, 138, 25);
    panelSurv3.add(label_9);

    JLabel lblframe3LicenseAgreement =
        new JLabel("Something about this license agreement annoyed me");
    lblframe3LicenseAgreement.setBounds(10, 304, 463, 14);
    panelSurv3.add(lblframe3LicenseAgreement);

    JLabel label_12 = new JLabel("*WARNING* You cannot return to these answers.");
    label_12.setForeground(Color.RED);
    label_12.setBounds(89, 404, 277, 14);
    panelSurv3.add(label_12);

    btnPage4.setBounds(394, 400, 89, 23);
    panelSurv3.add(btnPage4);

    frame3.getContentPane().add(panelSurv4, "");
    panelSurv4.setLayout(null);

    JLabel lblNewLabel_10 =
        new JLabel("According to the license agreement, what does Penn State have ");
    lblNewLabel_10.setBounds(10, 11, 537, 14);
    panelSurv4.add(lblNewLabel_10);

    JLabel lblTheRightTo = new JLabel("the right to download from your computer?");
    lblTheRightTo.setBounds(10, 26, 504, 14);
    panelSurv4.add(lblTheRightTo);

    txtPSUDownload = new JTextField();
    txtPSUDownload.setBounds(10, 48, 553, 20);
    panelSurv4.add(txtPSUDownload);
    txtPSUDownload.setColumns(10);

    JLabel lblHowManyCopies =
        new JLabel("How many copies of Reflexology can you make for archival purposes?");
    lblHowManyCopies.setBounds(10, 79, 438, 14);
    panelSurv4.add(lblHowManyCopies);

    String[] archCopies = {"", "Don't know", "0", "1", "3", "5", "Unlimited"};
    cmbArchCopies = new JComboBox(archCopies);
    cmbArchCopies.setBounds(458, 79, 105, 20);
    panelSurv4.add(cmbArchCopies);

    JLabel lblYouCanLend = new JLabel("What can you do if you want to sue about Reflexology?");
    lblYouCanLend.setBounds(10, 116, 323, 14);
    panelSurv4.add(lblYouCanLend);

    JLabel lblUnderWhatCircumstances =
        new JLabel("Under what circumstances can Penn State terminate your use of the software? ");
    lblUnderWhatCircumstances.setBounds(10, 184, 537, 14);
    panelSurv4.add(lblUnderWhatCircumstances);

    txtTerminate = new JTextField();
    txtTerminate.setBounds(10, 209, 553, 20);
    panelSurv4.add(txtTerminate);
    txtTerminate.setColumns(10);

    sldTradKs = new JSlider();
    sldTradKs.setValue(-1);
    sldTradKs.setSnapToTicks(true);
    sldTradKs.setPaintTicks(true);
    sldTradKs.setPaintLabels(true);
    sldTradKs.setMinorTickSpacing(1);
    sldTradKs.setMinimum(1);
    sldTradKs.setMaximum(5);
    sldTradKs.setMajorTickSpacing(1);
    sldTradKs.setBounds(154, 268, 274, 45);
    panelSurv4.add(sldTradKs);

    JLabel label_13 = new JLabel("Strongly disagree");
    label_13.setHorizontalAlignment(SwingConstants.RIGHT);
    label_13.setBounds(20, 268, 124, 25);
    panelSurv4.add(label_13);

    JLabel label_14 = new JLabel("Strongly agree");
    label_14.setBounds(438, 268, 138, 25);
    panelSurv4.add(label_14);

    JLabel lblPeopleAreMore =
        new JLabel(
            "People are more likely to read traditional contracts than software license agreemenets");
    lblPeopleAreMore.setBounds(10, 240, 553, 14);
    panelSurv4.add(lblPeopleAreMore);

    JLabel lblwarningframe3Button =
        new JLabel("*WARNING* this button will instantly end the experiment ---->");
    lblwarningframe3Button.setForeground(Color.RED);
    lblwarningframe3Button.setBounds(38, 400, 350, 14);
    panelSurv4.add(lblwarningframe3Button);

    btnDone.setBounds(398, 391, 89, 23);
    panelSurv4.add(btnDone);

    txtArbite = new JTextField();
    txtArbite.setColumns(10);
    txtArbite.setBounds(10, 141, 553, 20);
    panelSurv4.add(txtArbite);

    ListenFor2Button lFor2Button = new ListenFor2Button();
    ListenFor3Button lFor3Button = new ListenFor3Button();
    ListenFor4Button lFor4Button = new ListenFor4Button();
    ListenFor5Button lFor5Button = new ListenFor5Button();
    btnPage2.addActionListener(lFor2Button);
    btnPage3.addActionListener(lFor3Button);
    btnPage4.addActionListener(lFor4Button);
    btnDone.addActionListener(lFor5Button);
  }
コード例 #16
0
ファイル: RealTimeTestFrame.java プロジェクト: chooshine/fep
  /**
   * Component initialization.
   *
   * @throws java.lang.Exception
   */
  private void jbInit() throws Exception {

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

    this.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    setSize(new Dimension(400, 621));
    setTitle("实时通讯模块测试程序");
    jButton1.setBounds(new Rectangle(11, 412, 82, 26));
    jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton1.setText("召测接口");
    jButton1.addActionListener(new RealTimeTestFrame_jButton1_actionAdapter(this));
    jButton2.setBounds(new Rectangle(10, 366, 83, 26));
    jButton2.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton2.setText("创建对象");
    jButton2.addActionListener(new RealTimeTestFrame_jButton2_actionAdapter(this));
    jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel1.setText("接入IP:");
    jLabel1.setBounds(new Rectangle(23, 22, 63, 16));
    jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel2.setText("接入端口:");
    jLabel2.setBounds(new Rectangle(23, 67, 63, 16));
    jTextField1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jTextField1.setText("172.19.74.13");
    txt_port.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_port.setText("3000");
    txt_port.setBounds(new Rectangle(84, 64, 88, 22));
    jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel3.setText("AppID:");
    jLabel3.setBounds(new Rectangle(23, 113, 63, 16));
    contentPane.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel4.setText("ZDLJDZ:");
    jLabel4.setBounds(new Rectangle(23, 158, 63, 16));
    jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel5.setText("规约号:");
    jLabel5.setBounds(new Rectangle(23, 186, 63, 16));
    jLabel6.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel6.setText("发送内容:");
    jLabel6.setBounds(new Rectangle(23, 333, 63, 16));
    jLabel7.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel7.setText("通讯方式:");
    jLabel7.setBounds(new Rectangle(21, 219, 63, 16));
    txt_AppID.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_AppID.setText("25");
    txt_AppID.setBounds(new Rectangle(84, 110, 83, 22));
    txt_zdljdz.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_zdljdz.setText("91010022");
    txt_zdljdz.setBounds(new Rectangle(84, 155, 88, 22));
    txt_gyh.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_gyh.setText("100");
    txt_gyh.setBounds(new Rectangle(84, 183, 63, 22));
    txt_txfs.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_txfs.setText("40");
    txt_txfs.setBounds(new Rectangle(84, 218, 63, 22));
    jTextField7.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_ip.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    InetAddress localhost = java.net.InetAddress.getLocalHost();
    String hostIP = localhost.getHostAddress();
    txt_ip.setText(hostIP);
    txt_ip.setBounds(new Rectangle(84, 19, 159, 22));
    txt_content.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_content.setText("6000000100111107");
    txt_content.setBounds(new Rectangle(84, 330, 298, 22));
    txt_content.addActionListener(new RealTimeTestFrame_txt_content_actionAdapter(this));
    jButton3.setBounds(new Rectangle(200, 412, 89, 26));
    jButton3.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton3.setText("发送短信");
    jButton3.addActionListener(new RealTimeTestFrame_jButton3_actionAdapter(this));
    jButton4.setBounds(new Rectangle(295, 366, 96, 26));
    jButton4.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton4.setText("自定义命令");
    jButton4.addActionListener(new RealTimeTestFrame_jButton4_actionAdapter(this));
    lab_yxj.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    lab_yxj.setText("优先级:");
    lab_yxj.setBounds(new Rectangle(23, 287, 61, 16));
    txt_gnm.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_gnm.setText("0D");
    txt_gnm.setBounds(new Rectangle(84, 251, 63, 22));
    jLabel9.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel9.setText("手机号码:");
    jLabel9.setBounds(new Rectangle(190, 67, 67, 16));
    txt_sjhm.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_sjhm.setText("13800571505");
    txt_sjhm.setBounds(new Rectangle(250, 64, 111, 22));
    jLabel10.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel10.setText("命令序号:");
    jLabel10.setBounds(new Rectangle(190, 112, 73, 16));
    txt_mlxh.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_mlxh.setText("1");
    txt_mlxh.setBounds(new Rectangle(250, 109, 110, 22));
    jButton5.setBounds(new Rectangle(105, 366, 83, 26));
    jButton5.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton5.setText("连接");
    jButton5.addActionListener(new RealTimeTestFrame_jButton5_actionAdapter(this));
    jButton6.setBounds(new Rectangle(200, 366, 83, 26));
    jButton6.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton6.setText("断开连接");
    jButton6.addActionListener(new RealTimeTestFrame_jButton6_actionAdapter(this));
    jLabel11.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel11.setText("终端逻辑地址:");
    jLabel11.setBounds(new Rectangle(164, 199, 87, 16));
    txt_listterminal.setText("12041234");
    txt_listterminal.setBounds(new Rectangle(252, 196, 130, 22));
    jButton8.setBounds(new Rectangle(170, 248, 90, 26));
    jButton8.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton8.setText("加入队列");
    jButton8.addActionListener(new RealTimeTestFrame_jButton8_actionAdapter(this));
    jButton9.setBounds(new Rectangle(283, 248, 85, 26));
    jButton9.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton9.setText("在线状态");
    jButton9.addActionListener(new RealTimeTestFrame_jButton9_actionAdapter(this));
    memo1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    memo1.setToolTipText("");
    memo1.setEditable(false);
    memo1.setLineWrap(true);
    memo1.setWrapStyleWord(true);
    memo1.setBounds(new Rectangle(17, 451, 361, 154));
    jButton7.setBounds(new Rectangle(226, 289, 92, 26));
    jButton7.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton7.setText("设置掉线");
    jButton7.addActionListener(new RealTimeTestFrame_jButton7_actionAdapter(this));
    jButton10.setBounds(new Rectangle(192, 155, 90, 23));
    jButton10.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton10.setText("手工建档");
    jButton10.addActionListener(new RealTimeTestFrame_jButton10_actionAdapter(this));
    jLabel12.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jLabel12.setText("功能码:");
    jLabel12.setBounds(new Rectangle(23, 254, 61, 16));
    txt_yxj.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    txt_yxj.setText("08");
    txt_yxj.setBounds(new Rectangle(84, 283, 63, 22));
    jButton11.setBounds(new Rectangle(105, 412, 82, 26));
    jButton11.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton11.setActionCommand("");
    jButton11.setText("获取结果");
    jButton11.addActionListener(new RealTimeTestFrame_jButton11_actionAdapter(this));
    jButton12.setBounds(new Rectangle(301, 412, 87, 26));
    jButton12.setFont(new java.awt.Font("宋体", Font.PLAIN, 12));
    jButton12.setText("批量测试");
    jButton12.addActionListener(new RealTimeTestFrame_jButton12_actionAdapter(this));
    contentPane.add(jLabel1);
    contentPane.add(jLabel2);
    contentPane.add(txt_port);
    contentPane.add(jLabel3);
    contentPane.add(jLabel4);
    contentPane.add(jTextField1);
    contentPane.add(txt_AppID);
    contentPane.add(txt_zdljdz);
    contentPane.add(jTextField7);
    contentPane.add(txt_ip);
    contentPane.add(txt_content);
    contentPane.add(jLabel6);
    contentPane.add(jLabel9);
    contentPane.add(txt_sjhm);
    contentPane.add(jLabel10);
    contentPane.add(txt_mlxh);
    contentPane.add(txt_listterminal);
    contentPane.add(jLabel11);
    contentPane.add(jButton8);
    contentPane.add(jButton9);
    contentPane.add(memo1);
    contentPane.add(jButton7);
    contentPane.add(jButton10);
    contentPane.add(txt_gnm);
    contentPane.add(txt_txfs);
    contentPane.add(txt_gyh);
    contentPane.add(jLabel5);
    contentPane.add(jLabel7);
    contentPane.add(jLabel12);
    contentPane.add(lab_yxj);
    contentPane.add(txt_yxj);
    contentPane.add(jButton2);
    contentPane.add(jButton5);
    contentPane.add(jButton6);
    contentPane.add(jButton4);
    contentPane.add(jButton1);
    contentPane.add(jButton11);
    contentPane.add(jButton3);
    contentPane.add(jButton12);
  }
コード例 #17
0
ファイル: CWNTPanel.java プロジェクト: tinevez/CWNS
  private void initGUI() {
    setLayout(new BorderLayout());

    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    add(tabbedPane);

    {
      final JPanel panelIntroduction = new JPanel();
      tabbedPane.addTab("Intro", null, panelIntroduction, null);
      panelIntroduction.setLayout(null);

      final JLabel lblCrownwearingNucleiTracker = new JLabel("Crown-Wearing Nuclei Segmenter");
      lblCrownwearingNucleiTracker.setFont(BIG_FONT);
      lblCrownwearingNucleiTracker.setHorizontalAlignment(SwingConstants.CENTER);
      lblCrownwearingNucleiTracker.setBounds(10, 11, 268, 30);
      panelIntroduction.add(lblCrownwearingNucleiTracker);

      final JLabel labelIntro = new JLabel(INTRO_TEXT);
      labelIntro.setFont(SMALL_FONT.deriveFont(11f));
      labelIntro.setBounds(10, 52, 268, 173);
      panelIntroduction.add(labelIntro);

      final JButton btnTestParamtersLive =
          new JButton("<html><div align=\"center\">Live test parameters</dic></html>");
      btnTestParamtersLive.setBounds(10, 292, 103, 72);
      btnTestParamtersLive.setFont(FONT);
      liveLaunched = false;
      btnTestParamtersLive.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
              if (liveLaunched) {
                stopLive();
                btnTestParamtersLive.setText(
                    "<html><div align=\"center\">Live test parameters</div></html>");
                liveLaunched = false;
              } else {
                launchLive();
                btnTestParamtersLive.setText(
                    "<html><div align=\"center\">Stop live test</div></html>");
                liveLaunched = true;
              }
            }
          });
      panelIntroduction.add(btnTestParamtersLive);

      final String segFrameButtonText = "<html><CENTER>Segment current frame</center></html>";
      final JButton segFrameButton = new JButton(segFrameButtonText);
      segFrameButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
              new Thread("CWNT thread") {
                @Override
                public void run() {
                  segFrameButton.setText("Segmenting...");
                  segFrameButton.setEnabled(false);
                  try {
                    launchSingleFrameSegmentation();
                  } finally {
                    segFrameButton.setEnabled(true);
                    segFrameButton.setText(segFrameButtonText);
                  }
                }
              }.start();
            }
          });
      segFrameButton.setFont(FONT);
      segFrameButton.setBounds(175, 292, 103, 72);
      panelIntroduction.add(segFrameButton);

      labelDurationEstimate = new JLabel();
      labelDurationEstimate.setBounds(10, 375, 268, 14);
      panelIntroduction.setFont(FONT);
      panelIntroduction.add(labelDurationEstimate);
    }

    final JPanel panelParams1 = new JPanel();
    {
      tabbedPane.addTab("Param set 1", null, panelParams1, null);
      panelParams1.setLayout(null);

      final JLabel lblFiltering = new JLabel("1. Filtering");
      lblFiltering.setFont(BIG_FONT);
      lblFiltering.setBounds(10, 11, 268, 29);
      panelParams1.add(lblFiltering);

      {
        final JLabel lblGaussianFilter = new JLabel("Gaussian filter \u03C3:");
        lblGaussianFilter.setFont(SMALL_FONT);
        lblGaussianFilter.setBounds(10, 51, 268, 14);
        panelParams1.add(lblGaussianFilter);

        gaussFiltSigmaSlider =
            new DoubleJSlider(0, 5 * scale, (int) (maskingParams[0] * scale), scale);
        gaussFiltSigmaSlider.setBounds(10, 76, 223, 23);
        panelParams1.add(gaussFiltSigmaSlider);

        gaussFiltSigmaText = new JFormattedTextField(new Double(maskingParams[0]));
        gaussFiltSigmaText.setHorizontalAlignment(SwingConstants.CENTER);
        gaussFiltSigmaText.setBounds(243, 76, 35, 23);
        gaussFiltSigmaText.setFont(FONT);
        panelParams1.add(gaussFiltSigmaText);

        link(gaussFiltSigmaSlider, gaussFiltSigmaText);
        gaussFiltSigmaSlider.addChangeListener(step1ChangeListener);
        gaussFiltSigmaText.addKeyListener(step1KeyListener);
      }

      final JLabel lblAnisotropicDiffusion = new JLabel("2. Anisotropic diffusion");
      lblAnisotropicDiffusion.setFont(BIG_FONT);
      lblAnisotropicDiffusion.setBounds(10, 128, 268, 29);
      panelParams1.add(lblAnisotropicDiffusion);

      {
        final JLabel lblNumberOfIterations = new JLabel("Number of iterations:");
        lblNumberOfIterations.setFont(SMALL_FONT);
        lblNumberOfIterations.setBounds(10, 168, 268, 14);
        panelParams1.add(lblNumberOfIterations);

        aniDiffNIterText = new JFormattedTextField(new Integer((int) maskingParams[1]));
        aniDiffNIterText.setHorizontalAlignment(SwingConstants.CENTER);
        aniDiffNIterText.setFont(FONT);
        aniDiffNIterText.setBounds(243, 193, 35, 23);
        panelParams1.add(aniDiffNIterText);

        aniDiffNIterSlider = new DoubleJSlider(0, 10, (int) maskingParams[1], 1);
        aniDiffNIterSlider.setBounds(10, 193, 223, 23);
        panelParams1.add(aniDiffNIterSlider);

        link(aniDiffNIterSlider, aniDiffNIterText);
        aniDiffNIterSlider.addChangeListener(step2ChangeListener);
        aniDiffNIterText.addKeyListener(step2KeyListener);
      }

      {
        final JLabel lblGradientDiffusionThreshold =
            new JLabel("Gradient diffusion threshold \u03BA:");
        lblGradientDiffusionThreshold.setFont(SMALL_FONT);
        lblGradientDiffusionThreshold.setBounds(10, 227, 268, 14);
        panelParams1.add(lblGradientDiffusionThreshold);

        aniDiffKappaText = new JFormattedTextField(new Double(maskingParams[2]));
        aniDiffKappaText.setHorizontalAlignment(SwingConstants.CENTER);
        aniDiffKappaText.setFont(FONT);
        aniDiffKappaText.setBounds(243, 252, 35, 23);
        panelParams1.add(aniDiffKappaText);

        aniDiffKappaSlider = new DoubleJSlider(1, 100, (int) maskingParams[2], 1);
        aniDiffKappaSlider.setBounds(10, 252, 223, 23);
        panelParams1.add(aniDiffKappaSlider);

        link(aniDiffKappaSlider, aniDiffKappaText);
        aniDiffKappaSlider.addChangeListener(step2ChangeListener);
        aniDiffKappaText.addKeyListener(step2KeyListener);
      }

      final JLabel lblDerivativesCalculation = new JLabel("3. Derivatives calculation");
      lblDerivativesCalculation.setFont(BIG_FONT);
      lblDerivativesCalculation.setBounds(10, 298, 268, 29);
      panelParams1.add(lblDerivativesCalculation);

      {
        final JLabel lblGaussianGradient = new JLabel("Gaussian gradient \u03C3:");
        lblGaussianGradient.setFont(FONT);
        lblGaussianGradient.setBounds(10, 338, 268, 14);
        panelParams1.add(lblGaussianGradient);

        gaussGradSigmaText = new JFormattedTextField(new Double(maskingParams[3]));
        gaussGradSigmaText.setFont(FONT);
        gaussGradSigmaText.setHorizontalAlignment(SwingConstants.CENTER);
        gaussGradSigmaText.setBounds(243, 363, 35, 23);
        panelParams1.add(gaussGradSigmaText);

        gaussGradSigmaSlider =
            new DoubleJSlider(0, 5 * scale, (int) (maskingParams[3] * scale), scale);
        gaussGradSigmaSlider.setBounds(10, 363, 223, 23);
        panelParams1.add(gaussGradSigmaSlider);

        link(gaussGradSigmaSlider, gaussGradSigmaText);
        gaussGradSigmaSlider.addChangeListener(step3ChangeListener);
        gaussGradSigmaText.addKeyListener(step3KeyListener);
      }
    }

    final JPanel panelParams2 = new JPanel();
    {
      tabbedPane.addTab("Param set 2", panelParams2);
      panelParams2.setLayout(null);

      final JLabel lblMasking = new JLabel("4. Masking");
      lblMasking.setFont(BIG_FONT);
      lblMasking.setBounds(10, 11, 268, 29);
      panelParams2.add(lblMasking);

      {
        final JLabel gammeLabel = new JLabel("\u03B3: tanh shift");
        gammeLabel.setFont(SMALL_FONT);
        gammeLabel.setBounds(10, 51, 268, 14);
        panelParams2.add(gammeLabel);

        gammaSlider =
            new DoubleJSlider(-5 * scale, 5 * scale, (int) (maskingParams[4] * scale), scale);
        gammaSlider.setBounds(10, 76, 223, 23);
        panelParams2.add(gammaSlider);

        gammaText = new JFormattedTextField(new Double(maskingParams[4]));
        gammaText.setFont(FONT);
        gammaText.setBounds(243, 76, 35, 23);
        panelParams2.add(gammaText);

        link(gammaSlider, gammaText);
        gammaSlider.addChangeListener(step4ChangeListener);
        gammaSlider.addKeyListener(step4KeyListener);
      }
      {
        final JLabel lblNewLabel_3 = new JLabel("\u03B1: gradient prefactor");
        lblNewLabel_3.setFont(SMALL_FONT);
        lblNewLabel_3.setBounds(10, 110, 268, 14);
        panelParams2.add(lblNewLabel_3);

        alphaSlider = new DoubleJSlider(0, 20 * scale, (int) (maskingParams[5] * scale), scale);
        alphaSlider.setBounds(10, 135, 223, 23);
        panelParams2.add(alphaSlider);

        alphaText = new JFormattedTextField(new Double(maskingParams[5]));
        alphaText.setFont(FONT);
        alphaText.setBounds(243, 135, 35, 23);
        panelParams2.add(alphaText);

        link(alphaSlider, alphaText);
        alphaSlider.addChangeListener(step4ChangeListener);
        alphaText.addKeyListener(step4KeyListener);
      }
      {
        final JLabel betaLabel = new JLabel("\u03B2: positive laplacian magnitude prefactor");
        betaLabel.setFont(SMALL_FONT);
        betaLabel.setBounds(10, 169, 268, 14);
        panelParams2.add(betaLabel);

        betaSlider = new DoubleJSlider(0, 20 * scale, (int) (maskingParams[6] * scale), scale);
        betaSlider.setBounds(10, 194, 223, 23);
        panelParams2.add(betaSlider);

        betaText = new JFormattedTextField(new Double(maskingParams[6]));
        betaText.setFont(FONT);
        betaText.setBounds(243, 194, 35, 23);
        panelParams2.add(betaText);

        link(betaSlider, betaText);
        betaSlider.addChangeListener(step4ChangeListener);
        betaText.addKeyListener(step4KeyListener);
      }
      {
        final JLabel epsilonLabel = new JLabel("\u03B5: negative hessian magnitude");
        epsilonLabel.setFont(SMALL_FONT);
        epsilonLabel.setBounds(10, 228, 268, 14);
        panelParams2.add(epsilonLabel);

        epsilonSlider = new DoubleJSlider(0, 20 * scale, (int) (scale * maskingParams[7]), scale);
        epsilonSlider.setBounds(10, 253, 223, 23);
        panelParams2.add(epsilonSlider);

        epsilonText = new JFormattedTextField(new Double(maskingParams[7]));
        epsilonText.setFont(FONT);
        epsilonText.setText("" + maskingParams[7]);
        epsilonText.setBounds(243, 253, 35, 23);
        panelParams2.add(epsilonText);

        link(epsilonSlider, epsilonText);
        epsilonSlider.addChangeListener(step4ChangeListener);
        epsilonText.addKeyListener(step4KeyListener);
      }
      {
        final JLabel deltaLabel = new JLabel("\u03B4: derivatives sum scale");
        deltaLabel.setFont(SMALL_FONT);
        deltaLabel.setBounds(10, 287, 268, 14);
        panelParams2.add(deltaLabel);

        deltaText = new JFormattedTextField(new Double(maskingParams[8]));
        deltaText.setFont(FONT);
        deltaText.setText("" + maskingParams[8]);
        deltaText.setBounds(243, 312, 35, 23);
        panelParams2.add(deltaText);

        deltaSlider = new DoubleJSlider(0, 5 * scale, (int) (maskingParams[8] * scale), scale);
        deltaSlider.setBounds(10, 312, 223, 23);
        panelParams2.add(deltaSlider);

        link(deltaSlider, deltaText);
        deltaSlider.addChangeListener(step4ChangeListener);
        deltaText.addKeyListener(step4KeyListener);
      }

      final JLabel lblEquation =
          new JLabel(
              "<html>M = \u00BD ( 1 + <i>tanh</i> ( \u03B3 - ( \u03B1 G + \u03B2 L + \u03B5 H ) / \u03B4 ) )</html>");
      lblEquation.setHorizontalAlignment(SwingConstants.CENTER);
      lblEquation.setFont(FONT.deriveFont(12f));
      lblEquation.setBounds(10, 364, 268, 35);
      panelParams2.add(lblEquation);
    }

    {
      final JPanel panel = new JPanel();
      tabbedPane.addTab("Param set 3", null, panel, null);
      panel.setLayout(null);

      final JLabel labelThresholding = new JLabel("5. Thresholding");
      labelThresholding.setBounds(10, 11, 268, 28);
      labelThresholding.setFont(BIG_FONT);
      panel.add(labelThresholding);

      final JLabel labelThresholdFactor = new JLabel("Threshold factor:");
      labelThresholdFactor.setFont(SMALL_FONT);
      labelThresholdFactor.setBounds(10, 50, 268, 14);
      panel.add(labelThresholdFactor);

      thresholdFactorSlider =
          new DoubleJSlider(0, 5 * scale, (int) (thresholdFactor * scale), scale);
      thresholdFactorSlider.setBounds(10, 75, 223, 23);
      panel.add(thresholdFactorSlider);

      thresholdFactorText = new JFormattedTextField(new Double(thresholdFactor));
      thresholdFactorText.setFont(FONT);
      thresholdFactorText.setBounds(243, 75, 35, 23);
      panel.add(thresholdFactorText);

      link(thresholdFactorSlider, thresholdFactorText);
      thresholdFactorSlider.addChangeListener(step5ChangeListener);
      thresholdFactorText.addKeyListener(step5KeyListener);
    }
  }
コード例 #18
0
 @SuppressWarnings("serial")
 private void initGUI() {
   try {
     setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     getContentPane().setLayout(null);
     this.setTitle("Overzicht");
     this.setVisible(true);
     {
       lStart = new JLabel();
       getContentPane().add(lStart);
       lStart.setText("Overzicht");
       lStart.setHorizontalAlignment(SwingConstants.CENTER);
       lStart.setBackground(new java.awt.Color(54, 190, 54));
       lStart.setFont(new java.awt.Font("Arial", 1, 36));
       lStart.setForeground(new java.awt.Color(0, 128, 64));
       lStart.setOpaque(true);
       lStart.setBounds(0, 0, 336, 49);
     }
     {
       pInzet = new JPanel();
       getContentPane().add(pInzet);
       pInzet.setBorder(
           BorderFactory.createTitledBorder(
               null,
               "Selectie",
               TitledBorder.LEADING,
               TitledBorder.DEFAULT_POSITION,
               new java.awt.Font("Tahoma", 1, 11)));
       pInzet.setLayout(null);
       pInzet.setBounds(14, 63, 308, 105);
       pInzet.setFont(new java.awt.Font("Tahoma", 1, 12));
       {
         lMin = new JLabel();
         pInzet.add(lMin);
         lMin.setText("Speler");
         lMin.setFont(new java.awt.Font("Arial", 0, 12));
         lMin.setBounds(17, 59, 62, 27);
       }
       {
         lMax = new JLabel();
         pInzet.add(lMax);
         lMax.setText("Spelronde");
         lMax.setFont(new java.awt.Font("Arial", 0, 12));
         lMax.setBounds(17, 26, 62, 25);
       }
       // Combo voor Spelrondes. Deze wordt eerst geladen. Na selectie
       // wordt de speler gevuld.
       {
         oc = new OverzichtController(this);
         String[] rondes = oc.GeefSpelrondes();
         ComboBoxModel cbSpelRondeModel = new DefaultComboBoxModel(rondes);
         cbSpelRonde = new JComboBox();
         pInzet.add(cbSpelRonde);
         cbSpelRonde.setModel(cbSpelRondeModel);
         cbSpelRonde.setBounds(91, 29, 156, 21);
         cbSpelRonde.setToolTipText("Maak een keuze uit de gespeelde speelronden.");
       }
       {
         bStart = new JButton();
         getContentPane().add(bStart);
         bStart.setText("Sluiten");
         bStart.setFont(new java.awt.Font("Arial", 0, 12));
         bStart.setBounds(196, 303, 75, 23);
         bStart.addActionListener(
             new ActionListener() {
               public void actionPerformed(ActionEvent evt) {
                 bStartActionPerformed(evt);
               }
             });
       }
     }
     pack();
     this.setSize(352, 364);
   } catch (Exception e) {
     e.printStackTrace();
   }
 } // private void initGUI()
コード例 #19
0
 /**
  * Sets the font.
  *
  * @param font a font
  */
 public void setFont(Font font) {
   super.setFont(font);
   if (area != null) {
     area.setFont(font);
   }
 }
コード例 #20
0
ファイル: GuestProfileView.java プロジェクト: kaiquan/ReUnite
  public JPanel getContentPane() {

    JPanel defaultPanel = new JPanel();
    defaultPanel.setLayout(
        new MigLayout(
            "",
            "[28.00][403.00,grow][][384.00,grow][][384.00,grow][106.00]",
            "[][40.00][20.00][98.00,grow][285.00][27.00][grow][18.00][]"));

    JLabel lblCreateYourInvitation = new JLabel("Welcome, " + guest.getUserName());
    lblCreateYourInvitation.setFont(new Font("Segoe UI", Font.PLAIN, 22));
    defaultPanel.add(lblCreateYourInvitation, "cell 1 1 5 1,alignx center,aligny bottom");

    JPanel form = new JPanel();
    form.setFont(new Font("Segoe UI Light", Font.PLAIN, 11));
    form.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Personal Details",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    defaultPanel.add(form, "cell 1 3 4 5,grow");
    form.setLayout(
        new MigLayout(
            "", "[][176.00,grow][102.00,grow][grow]", "[][][][][][][][][][128.00,grow][69.00]"));

    JLabel lblFirstName = new JLabel("First name: ");
    form.add(lblFirstName, "cell 0 0,alignx left");

    textField = new JTextField();
    textField.setMinimumSize(new Dimension(100, 20));
    textField.setPreferredSize(new Dimension(100, 20));
    textField.setText(Account.currentUser.getFirstName());
    form.add(textField, "cell 1 0,growx");
    textField.setColumns(10);

    JLabel lblLastName = new JLabel("Last name:");
    form.add(lblLastName, "cell 0 1,alignx left");

    textField_1 = new JTextField();
    form.add(textField_1, "cell 1 1,growx");
    textField_1.setColumns(10);
    textField_1.setText(Account.currentUser.getLastName());

    JLabel lblSchool = new JLabel("School:");
    form.add(lblSchool, "cell 0 2,alignx left");

    textField_4 = new JTextField();
    form.add(textField_4, "cell 1 2,growx");
    textField_4.setColumns(10);
    textField_4.setText(Account.currentUser.getSchool());

    JLabel lblEmailAdress = new JLabel("Email adress:");
    form.add(lblEmailAdress, "cell 0 5,alignx left");

    textField_2 = new JTextField();
    textField_2.setText(Account.currentUser.getEmail());
    form.add(textField_2, "cell 1 5,growx");
    textField_2.setColumns(10);

    JLabel lblHandphoneNumber = new JLabel("Phone number:");
    form.add(lblHandphoneNumber, "cell 0 6,alignx trailing");

    textField_5 = new JTextField();
    textField_5.setText(Account.currentUser.getHandphoneNo());
    form.add(textField_5, "cell 1 6,growx");
    textField_5.setColumns(10);

    JLabel lblDateOfBirth = new JLabel("Date of Birth:");
    form.add(lblDateOfBirth, "cell 0 3,alignx left");

    JComboBox<Integer> comboBox = new JComboBox<Integer>();
    form.add(comboBox, "flowx,cell 1 3,growx");

    JComboBox<Integer> comboBox_1 = new JComboBox<Integer>();
    form.add(comboBox_1, "cell 2 3,growx");

    JComboBox<Integer> comboBox_2 = new JComboBox<Integer>();
    form.add(comboBox_2, "cell 1 3,growx");

    JLabel lblNric = new JLabel("NRIC:");
    form.add(lblNric, "cell 0 7,alignx left");

    textField_3 = new JTextField();
    textField_3.setText(Account.currentUser.getNric());
    form.add(textField_3, "cell 1 7,growx");
    textField_3.setColumns(10);

    JLabel lblAddress = new JLabel("Address:");
    form.add(lblAddress, "cell 0 9,aligny top");

    textArea = new JTextArea();
    textArea.setText(Account.currentUser.getAddress());
    textArea.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    form.add(textArea, "cell 1 9 2 1,grow");

    JButton tglbtnUpdateDetails = new JButton("Update details");
    tglbtnUpdateDetails.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            Guest guest = new Guest();
            guest.setUserName(Account.currentUser.getUserName());
            guest.setFirstName(textField.getText());
            guest.setLastName(textField_1.getText());
            guest.setSchool(textField_4.getText());
            guest.setEmail(textField_2.getText());
            guest.setHandphoneNo(textField_5.getText());
            guest.setNric(textField_3.getText());
            guest.setAddress(textArea.getText());
            if (guest.CREATE_GUEST_ACCOUNT(guest)) {
              JOptionPane.showMessageDialog(null, "Your details have been updated successfully");
            }
          }
        });
    tglbtnUpdateDetails.setPreferredSize(new Dimension(101, 40));
    form.add(tglbtnUpdateDetails, "cell 0 10 4 1,alignx center,aligny bottom");

    final JLabel profilePicture = new JLabel("");
    profilePicture.setBorder(
        new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    defaultPanel.add(profilePicture, "flowy,cell 5 3,alignx center,gapy 5 0");
    profilePicture.setIcon(ImageHelper.loadImageIcon("userIcon.png", "", 215, -1, 5));

    JButton btnSelectPhoto = new JButton("Change profile picture");
    btnSelectPhoto.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            ImageIcon backupIcon = (ImageIcon) profilePicture.getIcon();

            Image image = IOHelper.getImageFile();
            if (image != null) {
              profilePicture.setIcon(
                  ImageHelper.getScaledImageIcon(new ImageIcon(image), 200, -1, 5));
            } else {
              profilePicture.setIcon(backupIcon);
            }
          }
        });
    defaultPanel.add(btnSelectPhoto, "cell 5 4,alignx center,aligny top");

    JLabel cutShadow = new JLabel("");
    cutShadow.setIcon(new ImageIcon(ImageHelper.loadImage("cutShadowBottom.png", "testing")));
    defaultPanel.add(cutShadow, "cell 1 8 5 1,alignx center");

    defaultPanel.add(new GuestActionsFooter(), "south,alignx center");

    JLabel lblNewLabel = new JLabel("");
    defaultPanel.add(lblNewLabel, "cell 5 3");
    lblNewLabel.setIcon(
        new ImageIcon(
            ImageHelper.loadImage("cutShadowTop.png", "testing").getScaledInstance(230, -1, 3)));

    return defaultPanel;
  }
コード例 #21
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
  /**
   * Initialize frame
   *
   * @throws java.lang.Exception
   */
  private void initializeModulesFrame() throws Exception {
    // frame initialization
    this.setFont(new java.awt.Font("Arial", 0, 11));
    this.setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(
                this.getClass().getResource("/keel/GraphInterKeel/resources/ico/logo/logo.gif")));
    this.setSize(new Dimension(640, 480));
    this.setTitle("Keel");
    this.setResizable(false);

    // Create panel
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(null);

    // panel background
    fondo.setText("");
    fondo.setBounds(new Rectangle(0, 0, 640, 480));
    fondo.setFont(new java.awt.Font("Arial", 0, 11));
    fondo.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/fondo.gif")));

    exit.setText("Exit KEEL");
    exit.setBounds(new Rectangle(294, 327, 129, 36));
    exit.setFont(new java.awt.Font("Arial", 0, 11));

    // labels associated to buttons
    labelSalir.setFont(new java.awt.Font("Arial", 1, 18));
    labelSalir.setForeground(Color.white);
    labelSalir.setText("Exit KEEL");
    labelSalir.setBounds(new Rectangle(40, 412, 595, 27));
    labelSalir.setVisible(false);

    labelBack.setFont(new java.awt.Font("Arial", 1, 18));
    labelBack.setForeground(Color.white);
    labelBack.setText("Back to Keel Suite Menu");
    labelBack.setBounds(new Rectangle(40, 412, 595, 27));
    labelBack.setVisible(false);

    labelLQD.setFont(new java.awt.Font("Arial", 1, 18));
    labelLQD.setForeground(Color.white);
    labelLQD.setText("Experiments Design with Low Quality Data");
    labelLQD.setBounds(new Rectangle(40, 412, 465, 27));
    labelLQD.setVisible(false);

    labelImbalance.setFont(new java.awt.Font("Arial", 1, 18));
    labelImbalance.setForeground(Color.white);
    labelImbalance.setText("Experiments with Imbalanced Datasets");
    labelImbalance.setBounds(new Rectangle(40, 412, 465, 27));
    labelImbalance.setVisible(false);

    labelNonParametric.setFont(new java.awt.Font("Arial", 1, 18));
    labelNonParametric.setForeground(Color.white);
    labelNonParametric.setText("Non-Parametric Statistical Analysis");
    labelNonParametric.setBounds(new Rectangle(40, 412, 465, 27));
    labelNonParametric.setVisible(false);

    labelSSL.setFont(new java.awt.Font("Arial", 1, 18));
    labelSSL.setForeground(Color.white);
    labelSSL.setText("Semi-Supervised Learning");
    labelSSL.setBounds(new Rectangle(40, 412, 465, 27));
    labelSSL.setVisible(false);

    labelMil.setFont(new java.awt.Font("Arial", 1, 17));
    labelMil.setForeground(Color.white);
    labelMil.setText("Experiments with Multiple Instance Learning");
    labelMil.setBounds(new Rectangle(40, 412, 465, 27));
    labelMil.setVisible(false);

    contentPane.setFont(new java.awt.Font("Arial", 0, 11));

    keel.setText("");
    keel.setBounds(new Rectangle(160, 13, 336, 33));
    keel.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/mod.png")));
    logotipo.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/logotipo.png")));
    logotipo.setBounds(new Rectangle(550, 13, 65, 43));
    logotipo.addMouseListener(new FrameModules_logotipo_mouseAdapter(this));

    logotipoSoft.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/Software.png")));
    logotipoSoft.setBounds(new Rectangle(30, 13, 75, 43));
    logotipoSoft.addMouseListener(new FrameModules_logotipoSoft_mouseAdapter(this));

    barraExit.setBounds(new Rectangle(0, 401, 751, 50));
    barraExit.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/exit.png")));
    accionExit.setText("jLabel2");
    accionExit.setBounds(new Rectangle(536, 409, 94, 38));
    accionExit.addMouseListener(new FrameModules_accionExit_mouseAdapter(this));

    back.setBounds(new Rectangle(406, 409, 110, 38));
    back.addMouseListener(new FrameModules_back_mouseAdapter(this));

    // lqd.setBounds(new Rectangle(50, 140, 244, 40));
    lqd.setBounds(new Rectangle(50, 120, 244, 40));
    lqd.addMouseListener(new Frame_lqd_mouseAdapter(this));

    // imbalance.setBounds(new Rectangle(50, 200, 264, 38));
    imbalance.setBounds(new Rectangle(50, 180, 264, 38));
    imbalance.addMouseListener(new Frame_imbalance_mouseAdapter(this));

    // nonParametric.setBounds(new Rectangle(50, 260, 400, 42));
    nonParametric.setBounds(new Rectangle(50, 240, 400, 42));
    nonParametric.addMouseListener(new Frame_nonParametric_mouseAdapter(this));

    SSL.setBounds(new Rectangle(50, 300, 400, 42));
    SSL.addMouseListener(new Frame_SSL_mouseAdapter(this));

    //  mil.setBounds(new Rectangle(50, 320, 400, 42));
    mil.setBounds(new Rectangle(50, 360, 400, 42));
    mil.addMouseListener(new Frame_mil_mouseAdapter(this));

    lqd.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/lqd.png")));
    imbalance.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/imbalance.png")));
    nonParametric.setIcon(
        new ImageIcon(
            this.getClass()
                .getResource("/keel/GraphInterKeel/resources/imag/menu/nonParametric.png")));
    SSL.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/SSL.png")));
    mil.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/mil.png")));
    back.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/back.png")));

    contentPane.add(back, null);
    contentPane.add(labelBack, null);

    contentPane.add(labelSalir, null);
    contentPane.add(labelLQD2, null);
    contentPane.add(labelLQD, null);
    contentPane.add(labelImbalance, null);
    contentPane.add(labelNonParametric, null);
    contentPane.add(labelSSL, null);
    contentPane.add(labelMil, null);
    // contentPane.add(lqd);
    contentPane.add(mil);
    contentPane.add(imbalance);
    contentPane.add(nonParametric);
    contentPane.add(SSL);
    contentPane.add(keel);
    contentPane.add(logotipo);
    contentPane.add(logotipoSoft);
    contentPane.add(barraExit);
    contentPane.add(fondo, null);
    contentPane.add(accionExit);
  }
コード例 #22
0
ファイル: MyDateChooseBtn.java プロジェクト: singleD/se2
    private void flushWeekAndDayPanal(Calendar c) {
      //            c.set
      c.set(Calendar.DAY_OF_MONTH, 1);
      c.setFirstDayOfWeek(0);
      int firstdayofWeek = c.get(Calendar.DAY_OF_WEEK);
      int lastdayofWeek = c.getActualMaximum(Calendar.DAY_OF_MONTH);
      String colname[] = {"日", "一", "二", "三", "四", "五", "六"};
      int today = getNowCalendar().get(Calendar.DAY_OF_MONTH);
      // 璁剧疆鍥哄畾瀛椾綋锛屼互鍏嶈皟鐢ㄧ幆澧冩敼鍙樺奖鍝嶇晫闈㈢編瑙�
      dayPanel.setFont(new java.awt.Font("寰蒋闆呴粦", java.awt.Font.PLAIN, 12));
      dayPanel.setLayout(new GridBagLayout());
      dayPanel.setBackground(palletTableColor);

      JLabel cell;

      for (int i = 0; i < 7; i++) {
        cell = new JLabel(colname[i]);
        cell.setHorizontalAlignment(JLabel.CENTER);
        cell.setPreferredSize(new Dimension(25, 25));
        if (i == 0 || i == 6) {
          cell.setForeground(weekendFontColor);
        } else {
          cell.setForeground(weekFontColor);
        }
        dayPanel.add(
            cell,
            new GridBagConstraints(
                i,
                0,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.CENTER,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0));
      }

      int actionCommandId = 1;
      for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 7; j++) {

          JButton numberButton = daysButton[i][j];
          actionCommandId = Integer.parseInt(numberButton.getActionCommand());
          if (actionCommandId == today) {
            numberButton.setBackground(todayBtnColor);
          }
          if ((actionCommandId + firstdayofWeek - 2) % 7 == 6
              || (actionCommandId + firstdayofWeek - 2) % 7 == 0) {
            numberButton.setForeground(weekendFontColor);
          } else {
            numberButton.setForeground(dateFontColor);
          }
          if (actionCommandId <= lastdayofWeek) {
            int y = 0;
            if ((firstdayofWeek - 1) <= (j + firstdayofWeek - 1) % 7) {
              y = i + 1;
            } else {
              y = i + 2;
            }
            dayPanel.add(
                numberButton,
                new GridBagConstraints(
                    (j + firstdayofWeek - 1) % 7,
                    y,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.NONE,
                    new Insets(0, 0, 0, 0),
                    0,
                    0));
          }
        }
      }
    }
コード例 #23
0
ファイル: UI_Module.java プロジェクト: biddyweb/radiommender
  /** @throws IOException */
  public void setting_panel() throws IOException {

    this.setTitle("Music World!!");

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // the line that reads the image file
    //	BufferedImage image = ImageIO.read(new File("icon.jpg"));
    // BufferedImage image = ImageIO.read(new File("C:/Users/Marium
    // Ahmad/work/P2P/GUI/ui/P2P/CT/icon.jpg"));
    this.setBounds(20, 20, 479, 483);

    //	ImagePanel panel = new ImagePanel(new ImageIcon("C:/Users/Marium
    // Ahmad/work/P2P/GUI/ui/P2P/CT/background_image_music.jpg").getImage());
    //	ImagePanel panel = new ImagePanel(new ImageIcon("background_image_music.jpg").getImage());

    /**
     * ****************************************************************************************************************************************************
     * Menu Bar
     * ****************************************************************************************************************************************************
     */
    JMenuBar menuBar = new JMenuBar();
    menuBar.setBackground(new Color(240, 240, 240));
    setJMenuBar(menuBar);

    JMenu FileMenu = new JMenu("File");
    FileMenu.setMnemonic('F');
    menuBar.add(FileMenu);

    JMenuItem OpenMenuItem = new JMenuItem("Open...");
    OpenMenuItem.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.showOpenDialog(null);
            File file = chooser.getSelectedFile();
            // file.getName().toLowerCase().endsWith(".mp3");
            String filename = file.getName();
          }
        });

    FileMenu.add(OpenMenuItem);

    JMenuItem CloseMenu = new JMenuItem("Close");
    FileMenu.add(CloseMenu);

    JMenuItem RPIMenu = new JMenuItem("Recently played item");
    FileMenu.add(RPIMenu);

    JMenuItem ExitMenu = new JMenuItem("Exit");
    ExitMenu.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            System.exit(0);
          }
        });
    FileMenu.add(ExitMenu);

    JMenu HelpMenu = new JMenu("Help");
    HelpMenu.setMnemonic('H');
    menuBar.add(HelpMenu);

    JMenuItem AboutMenu = new JMenuItem("About");
    HelpMenu.add(AboutMenu);

    JMenuItem ContentsMenu = new JMenuItem("Help Contents");
    HelpMenu.add(ContentsMenu);

    /*
     * **************************************************************************************************************************************************
     */

    contentPane = new JPanel();
    contentPane.setBackground(new Color(240, 240, 240));
    contentPane.setBorder(UIManager.getBorder("MenuBar.border"));
    setContentPane(contentPane);

    /**
     * ***************************************************************************************************************************************************
     * Adding genre list choice
     * ****************************************************************************************************************************************************
     */
    /*
     * Setting Fonts
     */
    Font SansSerif = new Font("SansSerif", Font.PLAIN, 14);
    contentPane.setFont(SansSerif);

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

    textField_2 = new JTextField();
    textField_2.setColumns(10);

    JLabel lblAlbum = new JLabel("Album");
    lblAlbum.setFont(new Font("Showcard Gothic", Font.PLAIN, 11));
    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(
        gl_panel_2
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_2
                    .createSequentialGroup()
                    .addGroup(
                        gl_panel_2
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_panel_2
                                    .createSequentialGroup()
                                    .addGap(45)
                                    .addComponent(lblAlbum))
                            .addGroup(
                                gl_panel_2
                                    .createSequentialGroup()
                                    .addGap(16)
                                    .addComponent(
                                        textField_2,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(17, Short.MAX_VALUE)));
    gl_panel_2.setVerticalGroup(
        gl_panel_2
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_2
                    .createSequentialGroup()
                    .addGap(5)
                    .addComponent(
                        textField_2, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblAlbum)));
    panel_2.setLayout(gl_panel_2);

    JPanel panel_1 = new JPanel();
    contentPane.add(panel_1);

    textField = new JTextField();
    textField.setColumns(10);

    JLabel lblGenre = new JLabel("Genre");
    lblGenre.setFont(new Font("Showcard Gothic", Font.PLAIN, 11));

    textField_1 = new JTextField();
    textField_1.setColumns(10);

    JLabel lblArtist = new JLabel("Artist");
    lblArtist.setFont(new Font("Showcard Gothic", Font.PLAIN, 11));
    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(
        gl_panel_1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_1
                    .createSequentialGroup()
                    .addGroup(
                        gl_panel_1
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(45)
                                    .addComponent(lblGenre))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(46)
                                    .addComponent(lblArtist))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(16)
                                    .addComponent(
                                        textField_1,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(16)
                                    .addComponent(
                                        textField,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(17, Short.MAX_VALUE)));
    gl_panel_1.setVerticalGroup(
        gl_panel_1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_1
                    .createSequentialGroup()
                    .addGap(5)
                    .addComponent(
                        textField, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(lblGenre)
                    .addGap(5)
                    .addComponent(
                        textField_1, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblArtist)));
    panel_1.setLayout(gl_panel_1);
    // String genre = chooser.getSelectedItem();
    // logger.debug(genre);
    // chooser.addItemListener((ItemListener) this);

    /* Event.itemStateChanged(ItemEvent e)
      //  {
            String result = chooser.getSelectedItem();
            myTextField.setText("Your Choice: " + result);
            logger.debug(result);
        //}

    */
    /*
     * **************************************************************************************************************************************************
     */

    /**
     * **************************************************************************************************************************************************
     * Adding Button
     * *****************************************************************************************************************************************
     */
    Component glue_2 = Box.createGlue();
    contentPane.add(glue_2);

    Component glue_4 = Box.createGlue();
    contentPane.add(glue_4);

    Component glue_5 = Box.createGlue();
    contentPane.add(glue_5);

    Component glue_6 = Box.createGlue();
    contentPane.add(glue_6);

    Component glue_7 = Box.createGlue();
    contentPane.add(glue_7);
    txtTypeGenrealbumartistName = new JTextField("Enter Song");
    contentPane.add(txtTypeGenrealbumartistName);
    txtTypeGenrealbumartistName.setSelectionColor(SystemColor.controlLtHighlight);
    txtTypeGenrealbumartistName.setPreferredSize(new Dimension(100, 20));
    txtTypeGenrealbumartistName.setBackground(SystemColor.activeCaption);
    txtTypeGenrealbumartistName.setForeground(new Color(102, 0, 204));

    JButton Pause = new JButton();
    Pause.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) { // **********For pause Button
          }
        });
    // **************This whole is for progress bar***********************************
    // final LongTask task = new LongTask();
    // int length = 0;
    // final JProgressBar progressBar = new JProgressBar(0,task.getLengthOfTask());
    // progressBar.setValue(0);
    // progressBar.setStringPainted(true);
    // *********************************************************************************

    JButton Play = new JButton();
    Play.setAlignmentX(Component.RIGHT_ALIGNMENT);
    Play.setAlignmentY(Component.BOTTOM_ALIGNMENT);
    Play.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            // To Do from the recommender system

            if (txtTypeGenrealbumartistName.getText().equals("Enter Song"))
              JOptionPane.showMessageDialog(null, "Enter something in the textbox to play");
            else {
              String UserInput = txtTypeGenrealbumartistName.getText();
              logger.debug(UserInput);
              // TO DO "UserInput to the recommender system

              // **********************OBSERVABLE*****************************
              try {
                Thread.sleep(500);
              } catch (InterruptedException e2) {
                // TODO Auto-generated catch block
                e2.printStackTrace();
              } // waiting for the input

              ObservableValue Observing_String = new ObservableValue(null);

              TextObserver Update_Value = new TextObserver(Observing_String);
              Observing_String.addObserver(
                  Update_Value); /// *********************use as many observer as you want....If you
                                 // find difficulty just email me.

              // Debugging*****************************************************************
              // Observe observe = new Observe();
              // **************************************************************************

              /*
               * Creating a list for checking
               * Arrange the progressBar accordingly
               *
               */
              String[] Check = new String[6];
              Check[0] = "One";
              //	        progressBar.setValue(2);
              Check[1] = "Two";
              //	        progressBar.setValue(4);
              Check[2] = "Three";
              //	        progressBar.setValue(6);
              Check[3] = "Four";
              //	        progressBar.setValue(8);
              Check[4] = "Five";
              //	        progressBar.setValue(10);
              Check[5] = "Six";

              // logger.debug("here1");
              for (int i = 0; i < Check.length; i++) {
                //  logger.debug( Iter.next() );

                Observing_String.setSong(Check[i]);
                /*
                 * The updated value is shown in the text bars...here you will observe the same value as I took a single observer...rest of the thing is in email.
                 */
                textField.setText(Update_Value.GetValue());
                textField_1.setText(Update_Value.GetValue());
                textField_2.setText(Update_Value.GetValue());

                try {
                  Thread.sleep(2000);
                } catch (InterruptedException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
                }
              }

              // DEBUGGING******************************************************************This is
              // used when you run it via Observe.java
              /*observe.startEngine();

              try
              {
                  Thread.sleep(3000);
              }
              catch (InterruptedException Check)
              {
                  Check.printStackTrace();
              }

              observe.stopEngine();*/
              // Debugging*******************************************************************
            }
          }
        });

    // contentPane.add(progressBar);             THE ADDITION OF PROGRESS BAR!

    // Play.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Play-icon.png"));
    contentPane.add(Play);

    JButton Stop = new JButton();
    Stop.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) { // *************For stop button
          }
        });

    Component glue = Box.createGlue();
    contentPane.add(glue);
    Stop.setAlignmentX(Component.RIGHT_ALIGNMENT);
    Stop.setAlignmentY(Component.TOP_ALIGNMENT);
    // Stop.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Stop-icon.png"));
    contentPane.add(Stop);
    Pause.setAlignmentX(Component.RIGHT_ALIGNMENT);
    Pause.setAlignmentY(Component.TOP_ALIGNMENT);
    // Pause.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Pause-icon.png"));
    contentPane.add(Pause);

    JButton Skip = new JButton();
    Skip.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) { // *****For the Skip button
          }
        });

    Component glue_1 = Box.createGlue();
    contentPane.add(glue_1);
    // Skip.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\button_fast_forward_right_next_skip_button_bak_icon_go_arrow.png"));
    contentPane.add(Skip);

    /**
     * **************************************************************************************************************************************************
     * Message display
     * **************************************************************************************************************************************************
     */
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setForeground(Color.WHITE);
    scrollPane.setFont(new Font("Arial", Font.PLAIN, 12));
    scrollPane.setBackground(Color.WHITE);

    // panel.add(scrollPane, BorderLayout.CENTER);

  }
コード例 #24
0
  @SuppressWarnings("unchecked")
  private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setBackground(new java.awt.Color(51, 153, 255));
    setPreferredSize(new java.awt.Dimension(360, 410));
    setResizable(false);

    jPanel1.setBackground(new java.awt.Color(51, 153, 255));
    jPanel1.setFont(new java.awt.Font("Bodoni MT Black", 0, 18));
    jPanel1.setPreferredSize(new java.awt.Dimension(300, 230));

    jTable1.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {}, new String[] {"Results with Rating > " + this.rating}) {

          boolean[] canEdit = new boolean[] {false};

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });
    jScrollPane1.setViewportView(jTable1);
    if (jTable1.getColumnModel().getColumnCount() > 0) {
      jTable1.getColumnModel().getColumn(0).setResizable(false);
    }

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addGap(44, 44, 44)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        252,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(54, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addGap(55, 55, 55)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        289,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(56, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE));

    pack();
  }
コード例 #25
0
  PropertyDialog(PropertyChangeListener listener) {
    assert listener != null;
    if (!(listener instanceof DigitalClock)) {
      throw new AssertionError("not to be passed");
    }
    digitalClock = (DigitalClock) listener;
    notifier = new PropertyChangeSupport(listener);
    notifier.addPropertyChangeListener(listener);

    setResizable(false);
    setModal(true);
    setTitle("property");
    setSize(WIDTH, HEIGHT);
    setFont(new Font(null, Font.PLAIN, FONT_SIZE));
    propertyArea.setFont(getFont());
    okCancelArea.setFont(getFont());

    GridBagConstraints componentConstraints = new GridBagConstraints();
    final int MARGIN = 5;
    componentConstraints.insets = new Insets(MARGIN, MARGIN, MARGIN, MARGIN);

    componentConstraints.gridx = 0;
    componentConstraints.gridy = 0;
    componentConstraints.anchor = GridBagConstraints.EAST;
    componentConstraints.fill = GridBagConstraints.NONE;
    propertyArea.add(new JLabel("font"), componentConstraints);
    componentConstraints.gridx = 1;
    componentConstraints.gridy = 0;
    componentConstraints.anchor = GridBagConstraints.WEST;
    componentConstraints.fill = GridBagConstraints.HORIZONTAL;
    propertyArea.add(fontCombo, componentConstraints);

    componentConstraints.gridx = 0;
    componentConstraints.gridy = 1;
    componentConstraints.anchor = GridBagConstraints.EAST;
    componentConstraints.fill = GridBagConstraints.NONE;
    propertyArea.add(new JLabel("font size"), componentConstraints);
    componentConstraints.gridx = 1;
    componentConstraints.gridy = 1;
    componentConstraints.anchor = GridBagConstraints.WEST;
    componentConstraints.fill = GridBagConstraints.HORIZONTAL;
    propertyArea.add(fontSizeCombo, componentConstraints);

    componentConstraints.gridx = 0;
    componentConstraints.gridy = 2;
    componentConstraints.anchor = GridBagConstraints.EAST;
    componentConstraints.fill = GridBagConstraints.NONE;
    propertyArea.add(new JLabel("font color"), componentConstraints);
    componentConstraints.gridx = 1;
    componentConstraints.gridy = 2;
    componentConstraints.anchor = GridBagConstraints.WEST;
    componentConstraints.fill = GridBagConstraints.HORIZONTAL;
    propertyArea.add(fontColorCombo, componentConstraints);

    componentConstraints.gridx = 0;
    componentConstraints.gridy = 3;
    componentConstraints.anchor = GridBagConstraints.EAST;
    componentConstraints.fill = GridBagConstraints.NONE;
    propertyArea.add(new JLabel("background color"), componentConstraints);
    componentConstraints.gridx = 1;
    componentConstraints.gridy = 3;
    componentConstraints.anchor = GridBagConstraints.WEST;
    componentConstraints.fill = GridBagConstraints.HORIZONTAL;
    propertyArea.add(backgroundColorCombo, componentConstraints);

    add(propertyArea, "Center");

    okButton = new JButton("OK");
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            notifier.firePropertyChange(DigitalClock.FONT_EVT, null, fontOnOpening);
            notifier.firePropertyChange(DigitalClock.FONT_SIZE_EVT, null, fontOnOpening.getSize());
            notifier.firePropertyChange(DigitalClock.FONT_COLOR_EVT, null, fontColorOnOpening);
            notifier.firePropertyChange(
                DigitalClock.BACKGROUND_COLOR_EVT, null, backgroundColorOnOpening);
            dispose();
          }
        });
    okCancelArea.add(okButton);
    okCancelArea.add(cancelButton);
    add(okCancelArea, "South");

    fontCombo.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            String selectedFontString = (String) fontCombo.getSelectedItem();
            for (final Font f : fontSet) {
              if (selectedFontString.equals(f.getFontName())) {
                notifier.firePropertyChange(DigitalClock.FONT_EVT, null, f);
                break;
              }
            }
          }
        });

    fontSizeCombo.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            int selectedFontSize = (int) fontSizeCombo.getSelectedItem();
            notifier.firePropertyChange(DigitalClock.FONT_SIZE_EVT, null, selectedFontSize);
          }
        });

    fontColorCombo.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            Color selectedColor = (Color) fontColorCombo.getSelectedItem();
            notifier.firePropertyChange(DigitalClock.FONT_COLOR_EVT, null, selectedColor);
          }
        });

    backgroundColorCombo.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            Color selectedColor = (Color) backgroundColorCombo.getSelectedItem();
            notifier.firePropertyChange(DigitalClock.BACKGROUND_COLOR_EVT, null, selectedColor);
          }
        });
  }
コード例 #26
0
ファイル: AddView.java プロジェクト: AndrexGold/PhoneBook
 protected JPanel createPanelTop() {
   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());
   panel.add(
       fullNameLabel,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           1,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       fullNameField,
       new GridBagConstraints(
           2,
           0,
           1,
           1,
           3,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       ageLabel,
       new GridBagConstraints(
           1,
           2,
           1,
           1,
           1,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       ageField,
       new GridBagConstraints(
           2,
           2,
           1,
           1,
           3,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       emailLabel,
       new GridBagConstraints(
           1,
           3,
           1,
           1,
           1,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       emailField,
       new GridBagConstraints(
           2,
           3,
           1,
           1,
           3,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       phoneNumberLabel,
       new GridBagConstraints(
           1,
           4,
           1,
           1,
           1,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.add(
       phoneNumberField,
       new GridBagConstraints(
           2,
           4,
           1,
           1,
           3,
           1,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(1, 1, 1, 1),
           1,
           1));
   panel.setFont(new Font("Georgia", Font.CENTER_BASELINE, 15));
   return panel;
 }