Beispiel #1
0
 /**
  * JBuilder自动生成的初始化界面方法
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   jPanel1.setLayout(borderLayout1);
   jPanel3.setPreferredSize(new Dimension(10, 30));
   jPanel4.setPreferredSize(new Dimension(30, 10));
   jPanel5.setPreferredSize(new Dimension(30, 10));
   jPanel6.setPreferredSize(new Dimension(10, 30));
   jPanel2.setLayout(verticalFlowLayout1);
   MoneyDuom.setBackground(Color.white);
   MoneyDuom.setFont(new java.awt.Font("Dialog", 0, 16));
   MoneyDuom.setPreferredSize(new Dimension(100, 30));
   MoneyDuom.setEditable(true);
   MoneyDuom.setText("");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
   jLabel1.setPreferredSize(new Dimension(70, 23));
   jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
   jLabel1.setText("金  额:");
   this.getContentPane().add(jPanel1, BorderLayout.CENTER);
   jPanel1.add(jPanel2, BorderLayout.CENTER);
   jPanel2.add(jPanel8, null);
   jPanel8.add(jLabel1, null);
   jPanel8.add(MoneyDuom, null);
   jPanel2.add(jPanel7, null);
   jPanel1.add(jPanel3, BorderLayout.SOUTH);
   jPanel1.add(jPanel4, BorderLayout.WEST);
   jPanel1.add(jPanel5, BorderLayout.EAST);
   jPanel1.add(jPanel6, BorderLayout.NORTH);
 }
  public BrickBreakerPanel() {
    // setSize(PANELWIDTH,BrickBreaker.GAMEHEIGHT);
    setPreferredSize(new Dimension(PANELWIDTH, BrickBreaker.GAMEHEIGHT));
    // setBackground(Color.GREEN);
    setBorder(BorderFactory.createLineBorder(Color.black));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel infopane = new JPanel();
    // infopane.setSize(PANELWIDTH, BrickBreaker.GAMEHEIGHT/2);
    infopane.setPreferredSize(
        new Dimension(PANELWIDTH, BrickBreaker.GAMEHEIGHT / 2 + BrickBreaker.GAMEHEIGHT % 2));
    infopane.add(new JLabel("BrickBreaker, made"));
    infopane.add(new JLabel("by Jeremy Lautman"));
    add(infopane);
    JPanel dataDisplay = new JPanel();
    // dataDisplay.setSize(PANELWIDTH,BrickBreaker.GAMEHEIGHT/2+BrickBreaker.GAMEHEIGHT%2);
    dataDisplay.setPreferredSize(
        new Dimension(PANELWIDTH, BrickBreaker.GAMEHEIGHT / 2 + BrickBreaker.GAMEHEIGHT % 2));
    dataDisplay.setLayout(new BoxLayout(dataDisplay, BoxLayout.Y_AXIS));
    scoreLabel = new JLabel("score: null");
    dataDisplay.add(scoreLabel);
    livesLabel = new JLabel("lives: null");
    dataDisplay.add(livesLabel);
    levelLabel = new JLabel("level: null");
    dataDisplay.add(levelLabel);
    add(dataDisplay);
  }
  public Frm() {
    left.setPreferredSize(new Dimension(110, 200));
    center.setPreferredSize(new Dimension(200, 200));
    this.setLayout(new BorderLayout());
    left.setBackground(Color.white);
    center.setBackground(Color.blue);

    this.add(left, BorderLayout.WEST);
    this.add(center, BorderLayout.CENTER);
  }
  public CommercialModel(JFrame mFrame) {
    mainFrame = mFrame;
    // Set the FlowLayout and the Dimensions for panels
    pnlName.setPreferredSize(new Dimension(450, 50));
    pnlName.setLayout(new FlowLayout());
    pnlAddress.setPreferredSize(new Dimension(450, 50));
    pnlAddress.setLayout(new FlowLayout());
    pnlContactPerson.setPreferredSize(new Dimension(450, 50));
    pnlContactPerson.setLayout(new FlowLayout());
    pnlContactPersonPhone.setPreferredSize(new Dimension(450, 50));
    pnlContactPersonPhone.setLayout(new FlowLayout());

    // Add buttons and labels to panels
    lblContactPersonPhone.setPreferredSize(new Dimension(450, 20));
    lblContactPersonPhone.setHorizontalAlignment(JLabel.CENTER);
    txtContactPersonPhone.setPreferredSize(new Dimension(250, 20));
    pnlContactPersonPhone.add(lblContactPersonPhone);
    pnlContactPersonPhone.add(txtContactPersonPhone);
    // Home
    lblContactPerson.setPreferredSize(new Dimension(450, 20));
    lblContactPerson.setHorizontalAlignment(JLabel.CENTER);
    txtContactPerson.setPreferredSize(new Dimension(250, 20));
    pnlContactPerson.add(lblContactPerson);
    pnlContactPerson.add(txtContactPerson);
    // Address
    lblAddress.setPreferredSize(new Dimension(450, 20));
    lblAddress.setHorizontalAlignment(JLabel.CENTER);
    txtAddress.setPreferredSize(new Dimension(250, 20));
    pnlAddress.add(lblAddress);
    pnlAddress.add(txtAddress);
    // Name
    lblName.setPreferredSize(new Dimension(450, 20));
    lblName.setHorizontalAlignment(JLabel.CENTER);
    txtName.setPreferredSize(new Dimension(250, 20));
    pnlName.add(lblName);
    pnlName.add(txtName);
    // Buttons
    btnAddCommercial.setPreferredSize(new Dimension(200, 30));
    btnCancel.setPreferredSize(new Dimension(200, 30));
    pnlButtons.add(btnAddCommercial);
    pnlButtons.add(btnCancel);

    // Container framePane = frame.getContentPane();
    CommercialModelWrapper.setLayout(new FlowLayout());
    CommercialModelWrapper.add(pnlButtons, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlContactPersonPhone, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlContactPerson, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlAddress, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlName, FlowLayout.LEFT);
    // Add the event handler to the button
    btnCancel.addActionListener(new btnCancel_Handler(mainFrame));
    btnAddCommercial.addActionListener(
        new CommercialModel_btnAddNew_Handler(
            mainFrame, txtName, txtAddress, txtContactPerson, txtContactPersonPhone));
  }
  public ListarHisClientes(Frame padre) {

    super((Frame) padre, true);
    try {
      // this.cod_cli=cod_cli;
      lblNombre = new JLabel();
      lblNombre.setText("Nombre:");
      lblNombre.setBounds(17, 15, 48, 16);
      txtNombre = new JTextField();
      txtNombre.setBounds(77, 13, 323, 20);

      pnlArriba = new JPanel();

      pnlAbajo = new JPanel();
      GridLayout pnlAbajoLayout = new GridLayout(1, 1);
      pnlAbajoLayout.setHgap(5);
      pnlAbajoLayout.setVgap(5);
      pnlAbajoLayout.setColumns(1);
      pnlAbajo.setLayout(pnlAbajoLayout);
      getContentPane().add(pnlAbajo, BorderLayout.CENTER);
      pnlAbajo.setPreferredSize(new java.awt.Dimension(859, 429));

      getContentPane().add(pnlArriba, BorderLayout.NORTH);
      pnlArriba.setPreferredSize(new java.awt.Dimension(892, 42));
      pnlArriba.setLayout(null);
      pnlArriba.add(lblNombre);
      pnlArriba.add(txtNombre);

      btnBuscar = new JButton();
      pnlArriba.add(btnBuscar);
      btnBuscar.setText("Buscar");
      btnBuscar.setBounds(325, 10, 81, 26);
      btnBuscar.setVisible(false);
      btnBuscar.addActionListener(this);

      jPanel1 = new JPanel();
      getContentPane().add(jPanel1, BorderLayout.SOUTH);
      jPanel1.setPreferredSize(new java.awt.Dimension(412, 5));

      jScrollPane1 = new JScrollPane();
      pnlAbajo.add(jScrollPane1);
      jScrollPane1.setPreferredSize(new java.awt.Dimension(859, 467));

      jTable1 = new JTable();
      jScrollPane1.setViewportView(jTable1);
      jTable1.setModel(modelo2);
      jTable1.addMouseListener(this);

      this.setSize(428, 266);
      getNombre(ConfigurarCuentas.cod_cli);
      listarXcod(ConfigurarCuentas.cod_cli);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 private void initGUI() {
   try {
     BorderLayout thisLayout = new BorderLayout();
     this.setLayout(thisLayout);
     this.setPreferredSize(new java.awt.Dimension(691, 416));
     {
       tiltePnl = new JPanel();
       BorderLayout tiltePnlLayout = new BorderLayout();
       tiltePnl.setLayout(tiltePnlLayout);
       this.add(tiltePnl, BorderLayout.NORTH);
       tiltePnl.setPreferredSize(new java.awt.Dimension(691, 51));
       {
         titleTxt = new JTextPane();
         tiltePnl.add(titleTxt, BorderLayout.WEST);
         titleTxt.setText("Welche Art von Event moechten Sie besuchen?");
         titleTxt.setPreferredSize(new java.awt.Dimension(626, 58));
         titleTxt.setBackground(new java.awt.Color(212, 208, 200));
         titleTxt.setEditable(false);
         titleTxt.setOpaque(false);
         titleTxt.setFont(new java.awt.Font("Segoe UI", 0, 18));
       }
     }
     {
       contentPnl = new JPanel();
       this.add(contentPnl, BorderLayout.CENTER);
       GridBagLayout contentPnlLayout = new GridBagLayout();
       contentPnlLayout.rowWeights = new double[] {0.0, 0.0, 0.1};
       contentPnlLayout.rowHeights = new int[] {20, 300, 7};
       contentPnlLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.1};
       contentPnlLayout.columnWidths = new int[] {30, 200, 200, 200, 7};
       contentPnl.setLayout(contentPnlLayout);
       contentPnl.setPreferredSize(new java.awt.Dimension(691, 365));
       {
         kindOfEventList = new LikeSelectionList();
         contentPnl.add(
             kindOfEventList,
             new GridBagConstraints(
                 1,
                 1,
                 1,
                 1,
                 0.0,
                 0.0,
                 GridBagConstraints.NORTH,
                 GridBagConstraints.NONE,
                 new Insets(0, 0, 0, 0),
                 0,
                 0));
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public JPanel createContentPane() {

    // We create a bottom JPanel to place everything on.
    JPanel totalGUI = new JPanel();

    // We set the layout of the main JPanel to be BoxLayout.
    // LINE_AXIS sets them left to right, PAGE_AXIS sets them
    // from top to bottom.
    totalGUI.setLayout(new BoxLayout(totalGUI, BoxLayout.LINE_AXIS));

    JPanel redPanel = new JPanel();
    redPanel.setBackground(Color.red);
    redPanel.setMinimumSize(new Dimension(50, 50));
    redPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(redPanel);

    // This is the first spacer. This creates a spacer 10px wide that
    // will never get bigger or smaller.
    totalGUI.add(Box.createRigidArea(new Dimension(10, 0)));

    JPanel yellowPanel = new JPanel();
    yellowPanel.setBackground(Color.yellow);
    yellowPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(yellowPanel);

    // This spacer takes any spare space and places it as part of the spacer
    // If you drag the window wider, the space will get wider.
    totalGUI.add(Box.createHorizontalGlue());

    JPanel greenPanel = new JPanel();
    greenPanel.setBackground(Color.green);
    greenPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(greenPanel);

    // This spacer is a custom spacer.
    // The minimum size acts like a rigid area that
    // will not get any smaller than 10 pixels on the x-axis (horizontal)
    // and not get any smaller than 50 pixels on the y axis (vertical).
    // The way the maximum size is set up means the spacer acts like glue
    // and will expand to fit the available space.

    Dimension minSize = new Dimension(10, 50);
    Dimension prefSize = new Dimension(10, 50);
    Dimension maxSize = new Dimension(Short.MAX_VALUE, 50);
    totalGUI.add(new Box.Filler(minSize, prefSize, maxSize));

    JPanel bluePanel = new JPanel();
    bluePanel.setBackground(Color.blue);
    bluePanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(bluePanel);

    totalGUI.setOpaque(true);
    return totalGUI;
  }
 /** Popup the chart panel */
 public void showChart() {
   if (m_outputFrame == null) {
     m_outputFrame = new JFrame("Strip Chart");
     m_outputFrame.getContentPane().setLayout(new BorderLayout());
     m_outputFrame.getContentPane().add(m_legendPanel, BorderLayout.WEST);
     m_outputFrame.getContentPane().add(m_plotPanel, BorderLayout.CENTER);
     m_outputFrame.getContentPane().add(m_scalePanel, BorderLayout.EAST);
     m_legendPanel.setMinimumSize(new Dimension(100, getHeight()));
     m_legendPanel.setPreferredSize(new Dimension(100, getHeight()));
     m_scalePanel.setMinimumSize(new Dimension(30, getHeight()));
     m_scalePanel.setPreferredSize(new Dimension(30, getHeight()));
     Font lf = new Font("Monospaced", Font.PLAIN, 12);
     m_legendPanel.setBorder(
         BorderFactory.createTitledBorder(
             BorderFactory.createEtchedBorder(Color.gray, Color.darkGray),
             "Legend",
             TitledBorder.CENTER,
             TitledBorder.DEFAULT_POSITION,
             lf,
             Color.blue));
     m_outputFrame.addWindowListener(
         new java.awt.event.WindowAdapter() {
           public void windowClosing(java.awt.event.WindowEvent e) {
             if (m_updateHandler != null) {
               System.err.println("Interrupting");
               m_updateHandler.interrupt();
               m_updateHandler = null;
             }
             synchronized (m_dataList) {
               m_dataList = new LinkedList();
             }
             m_outputFrame.dispose();
             m_outputFrame = null;
           }
         });
     m_outputFrame.pack();
     m_outputFrame.setSize(600, 150);
     m_outputFrame.setResizable(false);
     m_outputFrame.setVisible(true);
     int iwidth = m_plotPanel.getWidth();
     int iheight = m_plotPanel.getHeight();
     m_osi = m_plotPanel.createImage(iwidth, iheight);
     Graphics m = m_osi.getGraphics();
     m.fillRect(0, 0, iwidth, iheight);
     m_previousY[0] = -1;
     setRefreshWidth();
     if (m_updateHandler == null) {
       System.err.println("Starting handler");
       startHandler();
     }
   } else {
     m_outputFrame.toFront();
   }
 }
Beispiel #9
0
  /** Function for refreshing the status area after editing status items */
  public void repaintToolbar() {

    // Lets start by adding all the notifications
    for (Entry<String, JLabel> entry : statusItems.entrySet()) {
      JLabel statusItem = entry.getValue();
      statusItem.setFont(new Font("Arial", Font.PLAIN, 11));
      statusItem.setForeground(new Color(237, 237, 237));
      statusPanel.add(statusItem);
    }

    // Then add all the highlighted vessel info
    highlightPanel.removeAll();
    JLabel highlightTitle = new JLabel(" Highlighted Vessel");
    highlightTitle.setFont(new Font("Arial", Font.BOLD, 11));
    highlightTitle.setForeground(new Color(237, 237, 237));
    if (highlightItems.size() > 0) {
      highlightTitle.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(65, 65, 65)));
      highlightPanel.add(highlightTitle);
    }
    for (Entry<String, JLabel> entry : highlightItems.entrySet()) {
      JLabel highlightItem = entry.getValue();
      highlightItem.setFont(new Font("Arial", Font.PLAIN, 11));
      highlightItem.setForeground(new Color(237, 237, 237));
      highlightPanel.add(highlightItem);
    }

    // Then calculate the size of the status bar according to the number of
    // status items
    width = statusItemWidth;
    int innerHeight = statusItems.size() * statusItemHeight;
    // Expanding width highlight size.
    int innerHeight2 = highlightItems.size() * statusItemHeight;
    if (highlightItems.size() > 0) {
      innerHeight2 += statusItemHeight;
    }

    // find height of the two areas plus 7 for separator
    height = innerHeight + innerHeight2 + 7;

    if (!locked) {
      height = innerHeight + innerHeight2 + moveHandlerHeight;
    }

    // And finally set the size and repaint it
    statusPanel.setSize(width, innerHeight - statusPanelOffset);
    statusPanel.setPreferredSize(new Dimension(width, innerHeight - statusPanelOffset));
    // Also for highlight panel
    highlightPanel.setSize(width, innerHeight2 - statusPanelOffset);
    highlightPanel.setPreferredSize(new Dimension(width, innerHeight2 - statusPanelOffset));
    this.setSize(width, height);
    this.revalidate();
    this.repaint();
  }
  // wordCounterFrame class constructor
  public WordCounterFrame() {

    super("Word Counter"); // text on title of frame

    // create panels for layout
    JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.CENTER));

    // set up input textfield
    textField = new JTextField(20);
    panel1.add(textField);
    panel1.setPreferredSize(new Dimension(275, 40));

    // set up display text field for word count
    wordCount = new JLabel();
    wordCount.setText("Word Count: ");
    wordCountTxtField = new JTextField(2);
    wordCountTxtField.setEnabled(false);
    panel2.add(wordCount);
    panel2.add(wordCountTxtField);

    // set up display text field for unique word count
    uniqueCount = new JLabel();
    uniqueCount.setText("Unique Word Count: ");
    uniqueCountTxtField = new JTextField(2);
    uniqueCountTxtField.setEnabled(false);
    panel2.add(uniqueCount);
    panel2.add(uniqueCountTxtField);
    panel2.setPreferredSize(new Dimension(190, 100));

    // set up exit button
    button = new JButton("Exit");
    panel3.add(button);
    panel3.setPreferredSize(new Dimension(100, 50));

    // add the panels to the layout
    add(panel1, BorderLayout.NORTH);
    add(panel2, BorderLayout.LINE_START);
    add(panel3, BorderLayout.SOUTH);

    // register listeners for input textfield
    TextFieldHandler txtHandler = new TextFieldHandler();
    textField.addKeyListener(txtHandler);

    // register listeners for button
    ButtonHandler bHandler = new ButtonHandler();
    button.addActionListener(bHandler);
  } // end WordCounterFrame
  public static void main(String[] args) {
    JFrame frame = new JFrame("Demo of Additional Borders");
    frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10));

    JTextArea textField = new JTextArea();
    JPanel border = new JPanel(new BorderLayout());
    border.setPreferredSize(new Dimension(100, 100));
    border.add(new JScrollPane(textField), BorderLayout.CENTER);
    border.setBorder(
        new JideTitledBorder(
            new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH),
            "PartialEtchedBorder"));

    JTextArea textField2 = new JTextArea();
    JPanel border2 = new JPanel(new BorderLayout());
    border2.setPreferredSize(new Dimension(100, 100));
    border2.add(new JScrollPane(textField2), BorderLayout.CENTER);
    border2.setBorder(
        new JideTitledBorder(
            new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder"));

    JTextArea textField3 = new JTextArea();
    JPanel border3 = new JPanel(new BorderLayout());
    border3.setPreferredSize(new Dimension(100, 100));
    border3.add(new JScrollPane(textField3), BorderLayout.CENTER);
    border3.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"),
            BorderFactory.createEmptyBorder(0, 6, 4, 6)));

    panel.add(border, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border2, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border3, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createGlue(), JideBoxLayout.VARY);

    panel.setPreferredSize(new Dimension(500, 400));
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
  }
  protected void addComponents() {

    // Top label
    String topLabelText =
        "While support for verifying signed code"
            + " has not been implemented yet, some applets will not run "
            + "properly under the default restricted security level.";
    String bottomLabelText =
        "Do you want to run this applet under the "
            + "restricted security level? (clicking No will run this applet "
            + "without any security checking, and should only be done if you "
            + "trust the applet!)";

    JLabel topLabel = new JLabel(htmlWrap(topLabelText));
    topLabel.setFont(new Font(topLabel.getFont().toString(), Font.BOLD, 12));
    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.setBackground(Color.WHITE);
    topPanel.add(topLabel, BorderLayout.CENTER);
    topPanel.setPreferredSize(new Dimension(400, 80));
    topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    JLabel bottomLabel = new JLabel(htmlWrap(bottomLabelText));
    JPanel infoPanel = new JPanel(new BorderLayout());
    infoPanel.add(bottomLabel, BorderLayout.CENTER);
    infoPanel.setPreferredSize(new Dimension(400, 80));
    infoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // run and cancel buttons
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    JButton yes = new JButton(Translator.R("ButYes"));
    JButton no = new JButton(Translator.R("ButNo"));
    JButton cancel = new JButton(Translator.R("ButCancel"));
    yes.addActionListener(SetValueHandler.createSetValueListener(parent, YesNoCancel.yes()));
    no.addActionListener(SetValueHandler.createSetValueListener(parent, YesNoCancel.no()));
    cancel.addActionListener(SetValueHandler.createSetValueListener(parent, YesNoCancel.cancel()));
    initialFocusComponent = cancel;
    buttonPanel.add(yes);
    buttonPanel.add(no);
    buttonPanel.add(cancel);
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // all of the above
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(topPanel);
    add(infoPanel);
    add(buttonPanel);
  }
Beispiel #13
0
  /** コンストラクタ �?��ンポ�?ネント�?期化 */
  public LoungeFrame() {
    super("Lounge");

    setBounds(100, 100, 320, 500);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel topPanel = new JPanel();
    FlowLayout fl = new FlowLayout();
    fl.setAlignment(FlowLayout.LEFT);
    topPanel.setLayout(fl);
    topPanel.setPreferredSize(new Dimension(40, 40));

    joinBtn = new JButton("参加");
    joinBtn.setPreferredSize(new Dimension(60, 25));
    joinBtn.addActionListener(new JoinListener());
    topPanel.add(joinBtn);

    ceaseBtn = new JButton("退室");
    ceaseBtn.setPreferredSize(new Dimension(60, 25));
    ceaseBtn.addActionListener(new CeaseListener());
    ceaseBtn.setEnabled(false);
    topPanel.add(ceaseBtn);

    startBtn = new JButton("開始");
    startBtn.setPreferredSize(new Dimension(60, 25));
    startBtn.addActionListener(new StartListener());
    startBtn.setEnabled(false);
    topPanel.add(startBtn);

    JPanel mainPanel = new JPanel();
    FlowLayout fl2 = new FlowLayout();
    fl2.setAlignment(FlowLayout.CENTER);
    mainPanel.setLayout(fl2);
    mainPanel.setPreferredSize(new Dimension(400, 400));

    visitorPanel = new JScrollPane();
    visitorPanel.setPreferredSize(new Dimension(150, 300));
    mainPanel.add(visitorPanel);

    playerPanel = new JScrollPane();
    playerPanel.setPreferredSize(new Dimension(150, 300));
    mainPanel.add(playerPanel);

    add(topPanel, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.CENTER);

    setVisible(true);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    amountOfMoney.setText(Integer.toString(gameController.amountOfMoney));
    numbersPanel.setLayout(new GridLayout(2, 5));
    for (int i = 0; i < 10; i++) {
      buttons.add(new JButton(Integer.toString(i)));
      numbersPanel.add(buttons.get(i));
      buttons.get(i).addActionListener(this);
    }
    numbersPanel.setPreferredSize(new Dimension(1000, 400));

    inputsPanel.setLayout(new GridLayout(1, 5));

    for (int i = 0; i < 4; i++) {
      answers.add(new JButton(""));
      inputsPanel.add(answers.get(i));
      answers.get(i).setEnabled(false);
    }
    inputsPanel.add(deleteButton);
    deleteButton.addActionListener(this);
    submitButton.addActionListener(this);

    resultsPanel.setLayout(new GridLayout(2, 2));
    // resultsPanel.add(moneyLabel);
    // resultsPanel.add(amountOfMoney);
    resultsPanel.add(resultLabel);
    resultsPanel.add(result);

    this.setLayout(new BorderLayout());

    this.add(inputsPanel, BorderLayout.NORTH);
    this.add(numbersPanel, BorderLayout.CENTER);
    this.add(submitButton, BorderLayout.SOUTH);
    this.add(resultsPanel, BorderLayout.EAST);
  }
  private JPanel getMainPanel() {
    if (mainPanel == null) {
      mainPanel = new JPanel();
      mainPanel.setPreferredSize(new Dimension(550, 300));
      GridBagLayout layout = new GridBagLayout();

      mainPanel.setLayout(layout);

      GridBagConstraints constraints = new GridBagConstraints();

      constraints.fill = GridBagConstraints.BOTH;
      constraints.weightx = 2;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.gridwidth = 2;
      layout.setConstraints(getAvailableRobotsPanel(), constraints);
      mainPanel.add(getAvailableRobotsPanel());
      constraints.gridwidth = 1;
      constraints.weightx = 0;
      constraints.weighty = 0;
      constraints.anchor = GridBagConstraints.CENTER;
      layout.setConstraints(getButtonsPanel(), constraints);
      mainPanel.add(getButtonsPanel());
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      layout.setConstraints(getSelectedRobotsPanel(), constraints);
      mainPanel.add(getSelectedRobotsPanel());
    }
    return mainPanel;
  }
  /**
   * Tool for transferring annotation from one feature to other feature(s)
   *
   * @param feature
   * @param entryGroup
   * @param geneNames
   */
  public TransferAnnotationTool(
      final Feature feature, final EntryGroup entryGroup, final MatchPanel matchPanel) {
    super("Transfer Annotation Tool :: " + feature.getIDString());
    this.matchPanel = matchPanel;

    List<String> geneNames = null;
    if (matchPanel != null) geneNames = matchPanel.getGeneNameList();

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JPanel pane = new JPanel(new GridBagLayout());
    JScrollPane jsp = new JScrollPane(panel);
    panel.setBackground(Color.white);
    pane.setBackground(Color.white);
    panel.add(pane);

    JPanel framePanel = (JPanel) getContentPane();
    framePanel.add(jsp, BorderLayout.CENTER);
    framePanel.setPreferredSize(new Dimension(600, 600));

    final Vector<JCheckBox> geneNameCheckBoxes = new Vector<JCheckBox>();
    final Vector<QualifierPanel> qualifierPanels = new Vector<QualifierPanel>();

    addMainPanel(feature, pane, qualifierPanels, geneNameCheckBoxes, geneNames);
    addBottomButtons(
        qualifierPanels, geneNameCheckBoxes,
        framePanel, entryGroup);
    pack();
    setVisible(true);
  }
Beispiel #17
0
 public LoginDialog() {
   lblHost.setFont(font);
   lblHost.setForeground(new Color(51, 51, 102));
   lblWashU.setFont(font);
   lblWashU.setForeground(Color.WHITE);
   panel.add(lblHost);
   panel.add(loginPanel);
   panel.add(lblWashU);
   panel.setPreferredSize(new Dimension(400, 500));
   panel.setBorder(new BevelBorder(BevelBorder.RAISED));
   panel.setBackground(new Color(51, 51, 102));
   loginPanel.btnOK.addActionListener(this);
   loginPanel.txtUser.addKeyListener(this);
   loginPanel.txtPass.addKeyListener(this);
   loginPanel.lblGuestUserIcon.addMouseListener(customMouseListener);
   add(panel);
   buildLayout();
   setUndecorated(true);
   pack();
   setAlwaysOnTop(true);
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   Dimension windowSize = this.getPreferredSize();
   setBounds(
       (screenSize.width - windowSize.width) / 2,
       (screenSize.height - windowSize.height) / 2,
       windowSize.width,
       windowSize.height);
   setVisible(false);
 }
  private JPanel getJPanel1() {
    if (jPanel1 == null) {
      jPanel1 = new JPanel();
      jContentPane.add(jPanel1, BorderLayout.SOUTH);
      jPanel1.setPreferredSize(new Dimension(0, 20));
      jPanel1.setLayout(new BorderLayout());

      okButton = new JButton();
      okButton.setText("确定");
      okButton.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
              pressButton(BUTTON_OK);
            }
          });
      cancelButton = new JButton();
      cancelButton.setText("取消");
      cancelButton.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
              pressButton(BUTTON_CANCEL);
            }
          });

      jPanel1.add(okButton, BorderLayout.WEST);
      jPanel1.add(cancelButton, BorderLayout.EAST);
    }

    return jPanel1;
  }
  /** Inicializa los elementos del panel. */
  private void inicializaElementos() {
    buscarTodoPanel = new JPanel();
    buscarTodoPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    buscarJButton =
        new JButton(
            I18N.get(
                "RegistroExpedientes",
                "Catastro.RegistroExpedientes.ExportacionMasiva.buscarJButton"));

    buscarJButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            buscarJButtonActionPerformed();
          }
        });

    exportarJButton =
        new JButton(
            I18N.get(
                "RegistroExpedientes",
                "Catastro.RegistroExpedientes.ExportacionMasiva.exportarJButton"));
    exportarTodoJButton =
        new JButton(
            I18N.get(
                "RegistroExpedientes",
                "Catastro.RegistroExpedientes.ExportacionMasiva.exportarTodoJButton"));

    cancelarJButton =
        new JButton(
            I18N.get(
                "RegistroExpedientes",
                "Catastro.RegistroExpedientes.ExportacionMasiva.cancelarJButton"));
    cancelarJButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cierraInternalFrame();
          }
        });
    recopilaDatosBD();
    inicializaPanelBuscar();
    inicializaTablaBuscar();

    buscarTodoPanel.add(
        buscarJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(285, 335, 120, 30));
    buscarTodoPanel.add(
        exportarTodoJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 580, 110, 30));
    buscarTodoPanel.add(
        exportarJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 580, 80, 30));
    buscarTodoPanel.add(
        cancelarJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 580, 80, 30));

    buscarTodoPanel.setPreferredSize(new Dimension(700, 660));
    getContentPane().add(buscarTodoPanel);
    setSize(new Dimension(700, 660));
    this.setMaximizable(false);
    int w = (this.desktop.getWidth() / 2) - (this.getWidth() / 2);
    int d = (this.desktop.getHeight() / 2) - (this.getHeight() / 2) - 30;
    this.setLocation(w, d);
    this.setMaximumSize(new Dimension(650, 660));
  }
  private void createContent() {
    content = new JPanel();
    content.setPreferredSize(new Dimension(200, 750));
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    this.add(content, BorderLayout.CENTER);
  }
  private void init() {

    energyConsumptionStatsPanel = new JPanel(new GridLayout(17, 2, 5, 5));
    energyStatisticsLeftAlligmentPanel = new JPanel(new BorderLayout());
    energyConsumptionStatsPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
    energyStatisticsLeftAlligmentPanel.setBackground(
        UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));

    createRRCStatsPanel();
    createPeripheralStatisticsPanel();

    energyStatisticsPanel = new JPanel();
    energyStatisticsPanel.setLayout(new VerticalLayout());
    energyStatisticsPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
    energyStatisticsHeaderLabel = new JLabel(rb.getString("energy.title"));
    energyStatisticsHeaderLabel.setFont(HEADER_FONT);
    energyStatisticsPanel.add(energyStatisticsHeaderLabel);

    spacePanel = new JPanel();
    spacePanel.setPreferredSize(new Dimension(this.getWidth(), HEADER_DATA_SPACING));
    spacePanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
    energyStatisticsPanel.add(spacePanel);

    energyStatisticsPanel.add(energyConsumptionStatsPanel);

    energyStatisticsLeftAlligmentPanel.add(energyStatisticsPanel, BorderLayout.WEST);
  }
  public PlotterXY(String chartTitle) {
    setLayout(new BorderLayout());
    mIdeal = new XYSeries("Ideal  Position");
    mReal = new XYSeries("Ideal  Velocity");

    mCollection = new XYSeriesCollection();
    mCollection.addSeries(mIdeal);
    mCollection.addSeries(mReal);

    final JFreeChart chart =
        ChartFactory.createXYLineChart(
            chartTitle,
            "X (Inches)",
            "Y (Inches)",
            mCollection,
            PlotOrientation.VERTICAL,
            true,
            true,
            false);
    chart.setBackgroundPaint(Color.white);

    m_chartPanel = new ChartPanel(chart);
    m_chartPanel.setPreferredSize(new Dimension(400, 300));
    m_chartPanel.setBackground(getBackground());

    add(m_chartPanel, BorderLayout.CENTER);
  }
  HeatMapControls(ControlBar creator) {
    super();
    parent = creator;

    setLayout(new BorderLayout());
    super.setPreferredSize(new Dimension(255, 170));

    String[] organisms = SpeciesTable.getOrganisms();
    String[] options = new String[organisms.length + 1];

    options[0] = "None";
    for (int i = 0; i < organisms.length; i++) {
      options[i + 1] = organisms[i];
    }

    species = new JComboBox(options);
    species.addActionListener(this);
    for (String str : SpeciesTable.getOrganisms()) {}

    super.add(species, BorderLayout.SOUTH);
    super.add(new Gradient(), BorderLayout.CENTER);
    super.add(new JLabel("Least"), BorderLayout.WEST);
    super.add(new JLabel("Most"), BorderLayout.EAST);
    super.add(new JLabel("Heat Map Controls"), BorderLayout.NORTH);
    super.setVisible(true);
  }
    private void init() {

      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      contentPane.setPreferredSize(new Dimension(screenSize.width / 2, screenSize.height / 3));

      setContentPane(contentPane);
      contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
      buttonBar.setLayout(new FlowLayout());
      buttonBarGrid.setLayout(new FlowLayout());

      JButton cancelButton = new JButton();
      JButton okButton = new JButton();
      okButton.setText("OK");
      okButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              onOk();
            }
          });
      cancelButton.setText("CANCEL");
      cancelButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              onCancel();
            }
          });
      buttonBarGrid.add(okButton);
      buttonBarGrid.add(cancelButton);
      buttonBar.add(buttonBarGrid);

      controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.X_AXIS));
      controlsPanel.add(createTab());
      contentPane.add(controlsPanel, BorderLayout.NORTH);
      contentPane.add(buttonBar, BorderLayout.SOUTH);
    }
 private void createCheckBoxes() {
   JPanel checkboxPanel = new JPanel();
   floaterBox = new JCheckBox(DISABLE_GRAVITY_FOR_SELECTED_OBJECT_CHECK_BOX);
   checkboxPanel.add(floaterBox);
   floaterBox.setFocusable(false);
   floaterBox.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           myLevelEditor.getMover().getStats().isFloating = floaterBox.isSelected();
           for (GameObject g : myLevelEditor.getSelected()) {
             g.setIsFloating(floaterBox.isSelected());
           }
         }
       });
   cameraBox = new JCheckBox("Camera Toggle");
   cameraBox.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           myLevelEditor.getMover().getStats().isCameraFollow = cameraBox.isSelected();
           for (GameObject g : myLevelEditor.getSelected()) {
             g.setIsScreenFollowing(cameraBox.isSelected());
           }
         }
       });
   checkboxPanel.add(cameraBox);
   cameraBox.setFocusable(false);
   checkboxPanel.setPreferredSize(CHECKBOX_PANEL_SIZE);
   checkboxPanel.setMaximumSize(CHECKBOX_PANEL_SIZE);
   homePanel.add(checkboxPanel);
 }
  private JPanel createTimePanel() {
    timeLabel = new JLabel("0s");

    constructionSpeed = new JSlider(JSlider.HORIZONTAL, 0, 10, 0);
    constructionSpeed.setSnapToTicks(true);
    constructionSpeed.setMinorTickSpacing(1);
    constructionSpeed.setMajorTickSpacing(1);
    constructionSpeed.setPaintTicks(true);
    constructionSpeed.setPaintLabels(true);

    constructionSpeed.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            updateTotalBuildingTime();
          }
        });

    JPanel totalTimePanel = new JPanel();
    totalTimePanel.setBorder(new TitledBorder("Construction Time"));
    totalTimePanel.add(timeLabel);
    totalTimePanel.setMinimumSize(new Dimension(104, 0));
    totalTimePanel.setMaximumSize(new Dimension(104, 0));
    totalTimePanel.setPreferredSize(new Dimension(104, 0));

    JPanel constructionResearchPanel = new JPanel();
    constructionResearchPanel.setBorder(new TitledBorder("Construction Research Rank"));
    constructionResearchPanel.add(constructionSpeed);

    JPanel timePanel = new JPanel(new BorderLayout());
    timePanel.add(BorderLayout.WEST, totalTimePanel);
    timePanel.add(BorderLayout.CENTER, constructionResearchPanel);

    return timePanel;
  }
Beispiel #27
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
Beispiel #28
0
  public Overworld() {
    frame = new JFrame("Basic Game");
    JPanel panel = (JPanel) frame.getContentPane();
    panel.setPreferredSize(new Dimension(1000, 1000));
    panel.setLayout(null);

    canvas = new Canvas();
    canvas.setBounds(0, 0, 1020, 1020);
    canvas.setIgnoreRepaint(true);

    panel.add(canvas);

    canvas.addMouseListener(new MouseControl());
    canvas.addMouseMotionListener(new MyClass());
    canvas.addKeyListener(new KeyControl());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setResizable(false);
    frame.setVisible(true);

    canvas.createBufferStrategy(2);
    bufferStrategy = canvas.getBufferStrategy();

    canvas.requestFocus();
  }
  /** Creates the reusable dialog. */
  public SwingGroupTrackObjectDialog() {
    super();

    setTitle("Edit Preset");

    _myPanel = new JPanel();
    _myPanel.setPreferredSize(new Dimension(300, 300));
    createPresetCombo();
    // Make this dialog display it.
    setContentPane(_myPanel);

    // Handle window closing correctly.
    setDefaultCloseOperation(HIDE_ON_CLOSE);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {}
        });

    // Ensure the text field always gets the first focus.
    addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent ce) {}
        });
  }
  /**
   * Test custom title font and color use.
   *
   * <p>All values are passed in the constructor.
   */
  public void interactiveCustomTitleFont() {
    Icon icon = XTestUtils.loadDefaultIcon();
    assertNotNull("sanity: default icon loaded", icon);
    JPanel p = new JPanel(new BorderLayout());
    final JXHeader header =
        new JXHeader(
            "MyBigUglyTitle",
            "this is a long test with veeeeeeeeeeeeeery looooooong wooooooooooooords",
            icon);
    header.setTitleFont(new Font("serif", Font.BOLD, 36));
    header.setTitleForeground(Color.GREEN);
    p.add(header);
    p.setPreferredSize(new Dimension(400, 150));
    JXFrame frame = wrapInFrame(p, "Titlefont lost on updateUI / word wrapping JXHeader");
    Action action =
        new AbstractAction("updateUI") {

          public void actionPerformed(ActionEvent e) {
            header.updateUI();
          }
        };
    addAction(frame, action);
    Action tree =
        new AbstractAction("updateComponentTree") {

          public void actionPerformed(ActionEvent e) {
            SwingUtilities.updateComponentTreeUI(header);
          }
        };
    addAction(frame, tree);
    addMessage(frame, "title font set on header");
    show(frame);
  }