- import java.awt.EventQueue;
- public class MainWindow {
- private JFrame frmWidgetShella;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- MainWindow window = new MainWindow();
- window.frmWidgetShella.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public MainWindow() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frmWidgetShella = new JFrame();
- frmWidgetShella.setIconImage(Toolkit.getDefaultToolkit().getImage(MainWindow.class.getResource("/icons/icon.ico")));
- frmWidgetShella.setSize(new Dimension(800, 600));
- frmWidgetShella.getContentPane().setBackground(Color.DARK_GRAY);
- frmWidgetShella.getContentPane().setLayout(new BorderLayout(0, 0));
- JPanel panel = new JPanel();
- frmWidgetShella.getContentPane().add(panel, BorderLayout.SOUTH);
- frmWidgetShella.setFont(null);
- frmWidgetShella.setBackground(Color.WHITE);
- frmWidgetShella.setTitle("IMA Visual Editor v.0.1.a");
- frmWidgetShella.setBounds(100, 100, 533, 543);
- JMenuBar menuBar = new JMenuBar();
- menuBar.setBackground(UIManager.getColor("CheckBox.darkShadow"));
- frmWidgetShella.setJMenuBar(menuBar);
- JMenu mnFile = new JMenu("File");
- menuBar.add(mnFile);
- JMenuItem mntmNew = new JMenuItem("New");
- mnFile.add(mntmNew);
- JMenuItem mntmExit = new JMenuItem("Exit");
- mnFile.add(mntmExit);
- JMenu mnEdit = new JMenu("Edit");
- menuBar.add(mnEdit);
- JMenu mnView = new JMenu("View");
- menuBar.add(mnView);
- JMenu mnTools = new JMenu("Tools");
- menuBar.add(mnTools);
- JMenu mnOptions = new JMenu("Options");
- menuBar.add(mnOptions);
- JMenu mnHelp = new JMenu("Help");
- menuBar.add(mnHelp);
- Component horizontalGlue = Box.createHorizontalGlue();
- menuBar.add(horizontalGlue);
- JProgressBar progressBar = new JProgressBar();
- progressBar.setValue(50);
- menuBar.add(progressBar);
- }
- private static void addPopup(Component component, final JPopupMenu popup) {
- component.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent e) {
- if (e.isPopupTrigger()) {
- showMenu(e);
- }
- }
- public void mouseReleased(MouseEvent e) {
- if (e.isPopupTrigger()) {
- showMenu(e);
- }
- }
- private void showMenu(MouseEvent e) {
- popup.show(e.getComponent(), e.getX(), e.getY());
- }
- });
- }
- }