Exemple #1
0
  public GLDemo() {
    super(VNMRFrame.getVNMRFrame(), "Jogl Demo", false);

    DisplayOptions.addChangeListener(this);

    contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    gradientPanel = createGradientPanel();

    contentPane.add(gradientPanel, BorderLayout.CENTER);

    checkBox = new JCheckBox("Transparent", true);
    checkBox.setActionCommand("transparancy");
    checkBox.addActionListener(this);
    optionsPan = new JPanel();
    optionsPan.setLayout(new SimpleH2Layout(SimpleH2Layout.LEFT, 5, 0, true, false));
    optionsPan.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    optionsPan.add(checkBox);

    runButton = new JToggleButton("Run");
    runButton.setActionCommand("run");
    runButton.setSelected(false);
    runButton.addActionListener(this);

    optionsPan.add(runButton);

    getContentPane().add(optionsPan, BorderLayout.SOUTH);
    setSize(300, 300);
    setLocation(300, 300);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        stop();
                      }
                    })
                .start();
          }
        });
    setVisible(false);
  }
Exemple #2
0
  public LJ3MDApp() {
    tNum.setHorizontalAlignment(JTextField.CENTER);
    tTemp.setHorizontalAlignment(JTextField.CENTER);
    tRho.setHorizontalAlignment(JTextField.CENTER);
    tSpeed.setHorizontalAlignment(JTextField.CENTER);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    timer = new Timer(delay, this);
    timer.start();
    //        timer.stop();
    box.setVisible(true);
  }
Exemple #3
0
  public void jbInit() throws Exception {
    this.setLayout(null);
    fContractPriceTextField.setFont(new java.awt.Font("Dialog", 1, 11));
    fContractPriceTextField.setDisabledTextColor(Color.black);
    fContractPriceTextField.setEditable(false);
    fContractPriceTextField.setHorizontalAlignment(SwingConstants.RIGHT);
    fContractPriceTextField.setBounds(new java.awt.Rectangle(285, 182, 55, 21));
    fContractVolumeTextField.setFont(new java.awt.Font("Dialog", 1, 11));
    fContractVolumeTextField.setDisabledTextColor(Color.black);
    fContractVolumeTextField.setEditable(false);
    fContractVolumeTextField.setHorizontalAlignment(SwingConstants.RIGHT);
    fContractVolumeTextField.setBounds(new java.awt.Rectangle(285, 238, 55, 21));
    fContractVolumeLabel.setText(fRb.getString("CONTRACT_VOLUME"));
    fContractVolumeLabel.setForeground(Color.black);
    fContractVolumeLabel.setBounds(new java.awt.Rectangle(272, 218, 99, 17));
    fContractPriceLabel.setBounds(new java.awt.Rectangle(272, 160, 92, 17));
    fContractPriceLabel.setText(fRb.getString("CONTRACT_PRICE"));
    fContractPriceLabel.setForeground(Color.black);

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

    this.setBorder(BorderFactory.createEtchedBorder());
    this.setBounds(new java.awt.Rectangle(325, 7, 387, 283));
    this.setLayout(null);
    fBoardGraph.setBorder(BorderFactory.createEtchedBorder());
    fBoardGraph.setBounds(new java.awt.Rectangle(5, 26, 257, 243));
    fBoardGraph.getGraph().add(new UGraphData(fSellName, fSellColor));
    fBoardGraph.getGraph().add(new UGraphData(fBuyName, fBuyColor));
    fBoardGraph.setLeftMargin(60);
    this.add(fBoardGraph, null);
    this.add(fContractVolumeTextField, null);
    this.add(fContractVolumeLabel, null);
    this.add(fContractPriceTextField, null);
    this.add(fContractPriceLabel, null);
    this.add(fBoardLabel, null);
    this.add(fDayLabel, null);
    this.add(fXYToggleButton, null);
    this.add(fPreviousBoardLabel, null);
    this.add(fDay, null);
    this.add(fBoard, null);
    fBoardGraph.setBackground(Color.white);
    fBoardGraph.setNumOfHorizontalLine(0);
    fBoardGraph.setNumOfVerticalLine(0);
    fBoardGraph.setFixedMaxX(1);
    fBoardGraph.setFixedMinX(0);
    fBoardGraph.setFixedMaxY(1);
    fBoardGraph.setFixedMinY(0);
    addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent ce) {
            gUpdate();
          }
        });
  }