-
-
Save anonymous/ef021bf009b6cc20ab31 to your computer and use it in GitHub Desktop.
Myframe without chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.aiotrade.charting; | |
import java.awt.EventQueue; | |
import java.awt.GridBagConstraints; | |
import java.awt.GridBagLayout; | |
import java.awt.Insets; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.event.WindowAdapter; | |
import java.awt.event.WindowEvent; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import org.aiotrade.charting.view.ChartView; | |
import org.aiotrade.charting.view.pane.ChartPane; | |
public class MyChart { | |
private JFrame frame; | |
/** | |
* Launch the application. | |
*/ | |
public static void main(String[] args) { | |
EventQueue.invokeLater(new Runnable() { | |
public void run() { | |
try { | |
MyChart window = new MyChart(); | |
window.frame.setVisible(true); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
}); | |
} | |
/** | |
* Create the application. | |
*/ | |
public MyChart() { | |
initialize(); | |
} | |
/** | |
* Initialize the contents of the frame. | |
*/ | |
private void initialize() { | |
frame = new JFrame(); | |
frame.addWindowListener(new WindowAdapter() { | |
@Override | |
public void windowClosed(WindowEvent e) { | |
System.exit(0); | |
} | |
}); | |
frame.setBounds(100, 100, 450, 300); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
GridBagLayout gridBagLayout = new GridBagLayout(); | |
gridBagLayout.columnWidths = new int[] { 0, 0, 0 }; | |
gridBagLayout.rowHeights = new int[] { 0, 0, 0 }; | |
gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; | |
gridBagLayout.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE }; | |
frame.getContentPane().setLayout(gridBagLayout); | |
JPanel panel = new JPanel(); | |
GridBagConstraints gbc_panel = new GridBagConstraints(); | |
gbc_panel.insets = new Insets(10, 10, 10, 10); | |
gbc_panel.fill = GridBagConstraints.BOTH; | |
gbc_panel.gridx = 1; | |
gbc_panel.gridy = 0; | |
/** | |
* Start here | |
* Create a sample chart here use the AIOTrade API and add it to the panel. And try to add a grid. | |
*/ | |
panel.add(The Chart with a grid); | |
/** | |
* end | |
*/ | |
frame.getContentPane().add(panel, gbc_panel); | |
JButton OKButton = new JButton("OK"); | |
OKButton.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent e) { | |
System.exit(0); | |
} | |
}); | |
GridBagConstraints gbc_OKButton = new GridBagConstraints(); | |
gbc_OKButton.insets = new Insets(0, 0, 10, 0); | |
gbc_OKButton.gridx = 1; | |
gbc_OKButton.gridy = 1; | |
frame.getContentPane().add(OKButton, gbc_OKButton); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment