public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   new TabbedDialog();
 }
Beispiel #2
0
 /**
  * Start the chooser.
  *
  * @param args command line parameters
  */
 public static void main(final String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   new TestChooser().start(args);
 }
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception unused) {; // Ignore exception because we can't do anything. Will use
     // default.
   }
   new Dashboard();
 }
Beispiel #4
0
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     System.err.println("Look and feel not set.");
   }
   new gui();
 }
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     String message = "ExceptionWhileSettingSystemLookAndFeel";
     Logging.logger().log(java.util.logging.Level.WARNING, message, e);
   }
   start("World Wind - elevations demo", AppFrame.class);
 }
 /** @param args command line params */
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     f = UIManager.getDefaults().getFont("TabbedPane.font");
     f = new Font(f.getFamily(), Font.BOLD, f.getSize());
   } catch (Exception x) {
   }
   new TestProgram().start();
 }
    public void run() {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (Exception e) {
        // do nothing - fall back to default look and feel
      }

      // load the issues and display the browser
      final IssuesBrowser browser = new IssuesBrowser();
      browser.setStartupArgs(args);
      browser.run();
    }
 /** The run method sets up the GUI and calls methods to add its components. */
 public void run() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     // matches the operating system's look and feel
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
   }
   setupPanels();
   setupFrame();
   listener.setGUI(this); // sets the DungeonListener object's reference to this class
 }
 public static void initLookAndFeel() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException e) {
     throw new RuntimeException(e);
   } catch (InstantiationException e) {
     throw new RuntimeException(e);
   } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
   } catch (UnsupportedLookAndFeelException e) {
     throw new RuntimeException(e);
   }
 }
Beispiel #10
0
 /** Installs the Kunststoff and Plastic Look And Feels if available in classpath. */
 private static void initializeLookAndFeels() {
   // if in classpath thry to load JGoodies Plastic Look & Feel
   try {
     UIManager.installLookAndFeel(
         "JGoodies Plastic 3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
     UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
   } catch (Throwable t) {
     try {
       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
Beispiel #11
0
 // --------------------------------createAndShowGUI-----------------------------
 public static void createAndShowGUI() {
   Game thisGame = new Game();
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   JFrame.setDefaultLookAndFeelDecorated(true);
   thisGame.frame = new JFrame("Tactics");
   thisGame.oConn = new SocketManager();
   thisGame.scrBounds = thisGame.frame.getGraphicsConfiguration().getBounds();
   thisGame.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
   thisGame.frame.setDefaultLookAndFeelDecorated(true);
   thisGame.frame.addWindowListener(thisGame);
   thisGame.frame.setVisible(true);
 }
Beispiel #12
0
  public static void main(String[] args) throws Exception {
    // JFrame.setDefaultLookAndFeelDecorated(true);
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    ThumbMaker tm = new ThumbMaker();
    tm.pack();

    // center window onscreen
    Dimension window = tm.getSize();
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    int w = (screen.width - window.width) / 2;
    int h = (screen.height - window.height) / 2;
    tm.setLocation(w, h);

    tm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    tm.setVisible(true);
  }
 public static void createAndShowGUI() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   }
   JFrame frame = new JFrame("@title@");
   frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   frame.getContentPane().add(new MainPanel());
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
  InfinitestResultsPane() {
    setLayout(new BorderLayout());
    toolbar = createToolBar();
    animator = new ColorAnimator();
    progressBar = createProgressBar();
    tree = createTree();

    JPanel southComponent = new JPanel(new BorderLayout());
    if (UIManager.getSystemLookAndFeelClassName().equals("apple.laf.AquaLookAndFeel")) {
      southComponent.add(Box.createHorizontalStrut(RESIZE_WINDOW_HANDLE_WIDTH), BorderLayout.EAST);
    }
    southComponent.add(progressBar, BorderLayout.CENTER);
    southComponent.add(toolbar, BorderLayout.WEST);
    add(southComponent, BorderLayout.SOUTH);
    add(new JScrollPane(tree), BorderLayout.CENTER);
  }
Beispiel #15
0
  public static void main(String[] args) {
    // use look and feel for my system (Win32)
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    }

    TextFrame frame = new TextFrame();
    // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("Edit Text");
    frame.pack();

    // put the frame in the middle of the display
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(
        dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);

    frame.setVisible(true);
  }
Beispiel #16
0
  public static void main(String[] args) throws Throwable {
    Robot robot = new Robot();
    robot.setAutoDelay(250);

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    SwingUtilities.invokeAndWait(
        new Runnable() {

          @Override
          public void run() {
            JFrame frame = new JFrame("Test");
            frame.setContentPane(createPanel(frame));
            frame.setJMenuBar(createMenuBar());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
          }
        });

    robot.waitForIdle();

    // Change the default button to
    // force a call to BasicRootPaneUI.updateDefaultButtonBindings()
    Util.hitKeys(robot, KeyEvent.VK_TAB);

    // If the bug exists, then as soon as the menu appears,
    // the VK_ENTER, VK_DOWN, VK_UP and VK_ESC will have no
    // effect.
    Util.hitMnemonics(robot, KeyEvent.VK_U);
    Util.hitKeys(robot, KeyEvent.VK_ENTER);
    robot.waitForIdle();

    checkAction();

    Util.hitMnemonics(robot, KeyEvent.VK_U);
    Util.hitKeys(robot, KeyEvent.VK_DOWN);
    Util.hitKeys(robot, KeyEvent.VK_ENTER);
    robot.waitForIdle();

    checkAction();
  }
Beispiel #17
0
  // Main method
  public static void main(String[] args) {
    int qcom_qix = 0;

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (args.length > 0) {
      System.out.println("Queue : " + args[0]);
      try {
        qcom_qix = Integer.parseInt(args[0]);
      } catch (NumberFormatException e) {
        System.out.println("Syntax error in que number");
        qcom_qix = 0;
      }
    }
    // new Gdh( (Object) null);
    new JopSpider(qcom_qix);
  }
  public reminder(int m, int y, int m3, int y3) {
    m1 = m;
    y1 = y;
    m2 = m3;
    y2 = y3;

    try {
      f.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("skrm.jpg")));
      String cn = UIManager.getSystemLookAndFeelClassName();

      UIManager.setLookAndFeel(cn); // Use the native L&F
    } catch (Exception cnf) {
      System.out.println(cnf);
    }

    f = new JFrame("Print Reminders");
    f.setVisible(true);
    f.setLayout(null);
    f.setSize(300, 100);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    b = new JButton("Print Reminders");
    b.addActionListener(this);
    back = new JButton("Back");
    back.addActionListener(this);
    f.add(b);
    b.setBounds(10, 10, 100, 20);
    b.setMnemonic('P');
    f.add(back);
    back.setMnemonic('B');
    back.setBounds(150, 10, 100, 20);
    // f.pack();

  }
 /** Applet initialization */
 public void init() {
   // Get the port to be used
   String port_str = getParameter("port");
   if (port_str != null) {
     port = Integer.parseInt(port_str);
   }
   // Try to use the system look and feel
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   // Create main panel to hold notebook
   main_panel = new JPanel();
   main_panel.setBackground(Color.white);
   main_panel.setLayout(new BorderLayout());
   setContentPane(main_panel);
   // Create the notebook
   tabbed_pane = new JTabbedPane(JTabbedPane.TOP);
   main_panel.add(tabbed_pane, BorderLayout.CENTER);
   // Add notebook page for default host connection
   pages = new Vector();
   addPage(new SOAPMonitorPage(getCodeBase().getHost()));
 }
Beispiel #20
0
 public static void createAndShowGUI() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   }
   JFrame frame = new JFrame("@title@");
   frame.setIconImages(
       Arrays.asList(
           makeBufferedImage(new StarIcon(), 16, 16),
           makeBufferedImage(new StarIcon(16, 8, 5), 40, 40)));
   // frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   // frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
   frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   frame.getContentPane().add(new MainPanel(frame));
   frame.setResizable(false);
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception exemp) {
      exemp.printStackTrace();
    }

    PanelSgavtraslo panel = new PanelSgavtraslo();
    panel.setBindingContext(
        JUTestFrame.startTestFrame(
            "DataBindings.cpx",
            "AppModuleDataControl1",
            panel,
            panel.getPanelBinding(),
            new Dimension(400, 300)));
    panel.revalidate();

    ViewObject voTraslo =
        panel.panelBinding.findIteratorBinding("SgavtrasloEntSal1Iter").getViewObject();

    System.out.println("whereClause: " + voTraslo.getWhereClause());

    // Michael 19.12.2007 pruebas
    AppModuleImpl am = (AppModuleImpl) panel.panelBinding.getApplication().getApplicationModule();
    SgavestadoentradaslomacViewImpl vo = am.getSgavestadoentradaslomacView1();
    vo.setWhereClauseParam(0, "300000008212");
    vo.executeQuery();
    SgavestadoentradaslomacViewRowImpl vr = (SgavestadoentradaslomacViewRowImpl) vo.first();
    oracle.jbo.domain.Number num = new oracle.jbo.domain.Number(1);

    vr.setUbicacionDestinoMac(num);

    //  Traslo traslo = new Traslo(1, "SLO", am);
    //  traslo.test();
    // TODO 19.12.2007

  }
  public static void createAndShowGUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
    }
    // UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.allAuditoryCues"));
    // UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.defaultCueList"));
    // UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues"));
    UIManager.put("AuditoryCues.playList", OPTION_PANE_AUDITORY_CUES);
    // UIManager.put("OptionPane.informationSound", "/example/notice2.wav");
    // UIManager.put("OptionPane.informationSound", "sounds/OptionPaneError.wav");
    // System.out.println(UIManager.get("AuditoryCues.actionMap"));

    JFrame frame = new JFrame("@title@");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(new MainPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
  public Manage_Inv() {
    // this.setTitle("Home_Page");
    // this.setSize(600,600);
    // this.setVisible(true);

    this.setTitle("Manage_Investments");
    this.setSize(600, 600);
    this.setVisible(true);

    this.setLayout(new BorderLayout(10, 10)); // Frame Layout
    this.setLocation(200, 100);
    Container cp = this.getContentPane();

    JPanel jp1 = new JPanel();
    jp1.setLayout(new BorderLayout(10, 10));
    JLabel jl1 = new JLabel("Welcome");
    jl1.setForeground(Color.RED);
    jp1.add(jl1, BorderLayout.PAGE_START);

    JPanel jp2 = new JPanel();
    jp2.setLayout(new GridLayout(2, 5, 20, 0));
    jp2.add(new JButton("Sensex"));
    jp2.add(new JButton("Nifty"));
    jp2.add(new JButton("CNX Midcap"));
    jp2.add(new JButton("BSE Smallcap"));
    jp2.add(new JButton("Networth"));
    jp2.add(new JTextField(5));
    jp2.add(new JTextField(5));
    jp2.add(new JTextField(5));
    jp2.add(new JTextField(5));
    jp2.add(new JTextField(5));
    jp1.add(jp2, BorderLayout.CENTER);
    jp1.add(new JSeparator(), BorderLayout.SOUTH);

    JPanel jp3 = new JPanel();
    jp3.setLayout(new BorderLayout(20, 20));
    jp3.add(new JPanel(), BorderLayout.WEST);
    jp3.add(new JPanel(), BorderLayout.EAST);
    jp3.add(new JPanel(), BorderLayout.NORTH);
    jp3.add(new JPanel(), BorderLayout.SOUTH);

    JPanel jp4 = new JPanel();
    jp4.setLayout(new GridLayout(3, 2, 10, 10));
    jp4.add(stocks);
    jp4.add(bullion);
    jp4.add(mf);
    jp4.add(fixed);
    jp4.add(property);
    jp4.add(loan);

    jp3.add(jp4);
    jp3.setBorder(BorderFactory.createTitledBorder("Manage_Investments"));
    cp.add(jp3, BorderLayout.CENTER);
    cp.add(jp1, BorderLayout.NORTH);

    // Adding action listner to stocks.....................
    stocks.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new Stocks().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
            ref.setVisible(false);
          }
        });
    // end of action listener of stocks.......................

    // Adding action listner to mf's.....................
    mf.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new MutualFunds().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
            ref.setVisible(false);
          }
        });
    // end of action listener of mf's.......................

    // adding of action listener of bullion.......................
    bullion.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new Bullion().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
            ref.setVisible(false);
          }
        });
    // end of action listener of bullion.......................

    // adding of action listener of fixed.......................
    fixed.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new FixedIncome().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
            ref.setVisible(false);
          }
        });
    // end of action listener of Fixed.......................

    // adding of action listener of property.5.......................
    property.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new Property().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
            ref.setVisible(false);
          }
        });
    // end of action listener of property.5.......................

    // adding of action listener of loan.6.......................
    loan.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new Loan().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
            ref.setVisible(false);
          }
        });
    // end of action listener of loan.6.......................

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    }
  }
  public static void main(String args[]) {
    // style that is necessary
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    } catch (UnsupportedLookAndFeelException e) {
    }

    // Standard preparation for a frame
    fmain = new JFrame("Schedule Appointments"); // Create and name frame
    fmain.setSize(330, 375); // Set size to 400x400 pixels
    pane = fmain.getContentPane();
    pane.setLayout(null); // Apply null layout
    fmain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close when X is clicked

    // controls and portions of Calendar
    lmonth = new JLabel("January");
    lyear = new JLabel("Change year:");
    cyear = new JComboBox();
    prev = new JButton("<<");
    next = new JButton(">>");
    canc = new JButton("Cancel");
    mcal =
        new DefaultTableModel() {
          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };
    Cal = new JTable(mcal);
    scal = new JScrollPane(Cal);
    pcal = new JPanel(null);

    canc.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    // action listeners for buttons and the like
    prev.addActionListener(new btnPrev_Action());
    next.addActionListener(new btnNext_Action());
    cyear.addActionListener(new cmbYear_Action());
    Cal.addMouseListener(new mouseCont());

    // Adding the elements to the pane
    pane.add(pcal);
    pcal.add(lmonth);
    pcal.add(cyear);
    pcal.add(prev);
    pcal.add(next);
    pcal.add(canc);
    pcal.add(scal);

    // Setting where the elements are on the pane
    pcal.setBounds(0, 0, 320, 335);
    lmonth.setBounds(160 - lmonth.getPreferredSize().width / 2, 25, 100, 25);
    canc.setBounds(10, 305, 80, 20);
    cyear.setBounds(215, 305, 100, 20);
    prev.setBounds(10, 25, 50, 25);
    next.setBounds(260, 25, 50, 25);
    scal.setBounds(10, 50, 300, 250);

    // Make frame visible
    fmain.setResizable(false);
    fmain.setVisible(true);

    // Inner workings for the day mechanism
    GregorianCalendar cal = new GregorianCalendar(); // Create calendar
    rday = cal.get(GregorianCalendar.DAY_OF_MONTH); // Get day
    rmonth = cal.get(GregorianCalendar.MONTH); // Get month
    ryear = cal.get(GregorianCalendar.YEAR); // Get year
    currentMonth = rmonth; // Match month and year
    currentYear = ryear;

    // Add days
    String[] days = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // All of the days
    for (int i = 0; i < 7; i++) {
      mcal.addColumn(days[i]);
    }

    Cal.getParent().setBackground(Cal.getBackground()); // Set background

    // No resize/reorder
    Cal.getTableHeader().setResizingAllowed(false);
    Cal.getTableHeader().setReorderingAllowed(false);

    // Single cell selection
    Cal.setColumnSelectionAllowed(true);
    Cal.setRowSelectionAllowed(true);
    Cal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // Set row/column count
    Cal.setRowHeight(38);
    mcal.setColumnCount(7);
    mcal.setRowCount(6);

    // Placing the dates in the cells
    for (int i = ryear - 100; i <= ryear + 100; i++) {
      cyear.addItem(String.valueOf(i));
    }

    // Refresh calendar
    refreshCalendar(rmonth, ryear); // Refresh calendar
  }
 private static void initGui() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception exception) {
     exception.printStackTrace();
   }
   JFrame frame = new JFrame("DarkBot");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLayout(new GridBagLayout());
   Insets noInsets = new Insets(0, 0, 0, 0);
   final JToggleButton sessionsButton = new JToggleButton("Login (0)");
   frame.add(
       sessionsButton,
       new GridBagConstraints(
           0, 0, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   sessionsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           sessions.set(sessionsButton.isSelected());
           synchronized (sessions) {
             sessions.notifyAll();
           }
         }
       });
   final JToggleButton joinsButton = new JToggleButton("Join (0)");
   frame.add(
       joinsButton,
       new GridBagConstraints(
           0, 1, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   joinsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           joins.set(joinsButton.isSelected());
           synchronized (joins) {
             joins.notifyAll();
           }
         }
       });
   final JTextField field = new JTextField();
   frame.add(
       field,
       new GridBagConstraints(
           0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   final JButton button = new JButton("Start");
   frame.add(
       button,
       new GridBagConstraints(
           1, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   button.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           if (button.getText().startsWith("Start")) {
             field.setEnabled(false);
             spamMessage = field.getText();
             button.setText("Stop");
           } else {
             spamMessage = null;
             button.setText("Start");
             field.setEnabled(true);
           }
         }
       });
   Timer timer =
       new Timer(
           500,
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
               sessionsButton.setText(
                   sessionsButton.getText().split(" ")[0]
                       + " ("
                       + Integer.toString(sessionCount.get())
                       + ")");
               joinsButton.setText(
                   joinsButton.getText().split(" ")[0]
                       + " ("
                       + Integer.toString(amountJoined.get())
                       + ")");
             }
           });
   timer.setRepeats(true);
   timer.start();
   frame.pack();
   frame.setSize(500, frame.getHeight());
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Beispiel #26
0
  /** Initializes the applet SVGApplet */
  public void init() {
    // Set look and feel
    // -----------------
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Throwable e) {
      // Do nothing.
      // If we can't set the desired look and feel, UIManager does
      // automaticaly the right thing for us.
    }

    // Display copyright info while we are loading the data
    // ----------------------------------------------------
    Container c = getContentPane();
    c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
    String[] labels = getAppletInfo().split("\n"); // Strings.split(getAppletInfo(), '\n');
    for (int i = 0; i < labels.length; i++) {
      c.add(new JLabel((labels[i].length() == 0) ? " " : labels[i]));
    }

    // We load the data using a worker thread
    // --------------------------------------
    new Worker() {

      public Object construct() {
        Object result = null;

        InputStream in = null;
        try {
          // Try to read the data using all known input formats.
          Drawing drawing = createDrawing();
          for (InputFormat fmt : drawing.getInputFormats()) {
            try {
              if (getParameter("data") != null) {
                in = new ByteArrayInputStream(getParameter("data").getBytes("UTF8"));
              } else if (getParameter("datafile") != null) {
                URL url = new URL(getDocumentBase(), getParameter("datafile"));
                in = url.openConnection().getInputStream();
              }
              if (in != null) {
                fmt.read(in, drawing);
                result = drawing;
                break;
              }
            } catch (IOException e) {
              result = e;
            }
          }
        } catch (Throwable t) {
          result = t;
        } finally {
          if (in != null) {
            try {
              in.close();
            } catch (IOException ex) {
              // ignore
            }
          }
        }
        return result;
      }

      public void finished(Object result) {
        if (result instanceof Throwable) {
          ((Throwable) result).printStackTrace();
        }
        Container c = getContentPane();
        c.setLayout(new BorderLayout());
        c.removeAll();
        c.add(drawingPanel = new SVGDrawingPanel());

        initComponents();
        if (result != null) {
          if (result instanceof Drawing) {
            setDrawing((Drawing) result);
          } else if (result instanceof Throwable) {
            getDrawing().add(new SVGTextFigure(result.toString()));
            ((Throwable) result).printStackTrace();
          }
        }

        c.validate();
      }
    }.start();
  }
Beispiel #27
0
  void initWindow() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (UnsupportedLookAndFeelException e) {
      // handle exception
    } catch (ClassNotFoundException e) {
      // handle exception
    } catch (InstantiationException e) {
      // handle exception
    } catch (IllegalAccessException e) {
      // handle exception
    }

    myFrame = new JFrame("Chrono");
    myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    myFrame.getContentPane().setLayout(null);

    JFrage = new JLabel("FRAGE", JLabel.CENTER);
    JFrage.setFont(new Font("Courier New", Font.BOLD, 18));
    JFrage.setForeground(Color.BLACK);
    JFrage.setBackground(Color.GRAY);
    JFrage.setOpaque(true);
    JFrage.setBounds(200, 20, 400, 40);

    myFrame.add(JFrage);

    JAntwort = new JLabel[10];
    JPosition = new JLabel[10];
    JPosNr = new JLabel[11];
    JAntNr = new JLabel[10];

    JPosNr[8] = new JLabel("9" + " >", JLabel.CENTER);
    // JPosNr[9] = new JLabel("10" + " >",JLabel.CENTER);

    JPosNr[8].setFont(new Font("Courier New", Font.BOLD, 18));
    JPosNr[8].setForeground(Color.BLACK);
    // JPosNr[8].setBackground(Color.GRAY);
    JPosNr[8].setOpaque(true);
    JPosNr[8].setBounds(5, 475, 45, 40);
    myFrame.add(JPosNr[8]);
    // JPosNr[9].setBounds(5,525,45,40);
    // myFrame.add(JPosNr[9]);

    for (int j = 0; j < 8; ++j) {
      JAntwort[j] = new JLabel("Antwort " + (j + 1), JLabel.CENTER);

      JAntwort[j].setFont(new Font("Courier New", Font.BOLD, 18));
      JAntwort[j].setForeground(Color.BLACK);
      JAntwort[j].setBounds(450, 100 + (j * 50), 300, 40);

      // Hintergrund
      JAntwort[j].setBackground(Color.GRAY);
      JAntwort[j].setOpaque(true);
      // Rahmen

      Border blackline = BorderFactory.createLineBorder(Color.black);
      JAntwort[j].setBorder(blackline);

      myFrame.add(JAntwort[j]);

      JPosition[j] = new JLabel("Position " + (j + 1), JLabel.CENTER);

      JPosition[j].setFont(new Font("Courier New", Font.BOLD, 18));
      JPosition[j].setForeground(Color.BLACK);
      JPosition[j].setBackground(Color.GRAY);
      JPosition[j].setOpaque(true);
      JPosition[j].setBounds(50, 100 + (j * 50), 300, 40);
      myFrame.add(JPosition[j]);

      JPosNr[j] = new JLabel("" + (j + 1) + " >", JLabel.CENTER);

      JPosNr[j].setFont(new Font("Courier New", Font.BOLD, 18));
      JPosNr[j].setForeground(Color.BLACK);
      // JPosNr[j].setBackground(Color.GRAY);
      JPosNr[j].setOpaque(true);
      JPosNr[j].setBounds(5, 75 + (j * 50), 45, 40);
      myFrame.add(JPosNr[j]);

      JAntNr[j] = new JLabel("" + (char) (j + 65) + ")");

      JAntNr[j].setFont(new Font("Courier New", Font.BOLD, 18));
      JAntNr[j].setForeground(Color.BLACK);
      // JAntNr[j].setBackground(Color.GRAY);
      JAntNr[j].setOpaque(true);
      JAntNr[j].setBounds(425, 100 + (j * 50), 45, 40);
      myFrame.add(JAntNr[j]);
    }

    myFrame.addKeyListener(this);

    myFrame.setSize(800, 600);
    myFrame.setLocation(200, 200);

    myFrame.setVisible(true);
  }
Beispiel #28
0
  public static void main(String argv[]) {
    System.setErr(System.out);

    try {

      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");

    } catch (Exception e) {
      try {

        UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");

      } catch (Exception e1) {
        try {

          UIManager.setLookAndFeel("javax.swing.plaf.motif.MotifLookAndFeel");

        } catch (Exception e2) {
          try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          } catch (Exception e3) {
          }
        }
      }
    }

    UIManager.put("TextField.background", new Color(255, 255, 255));
    String strCreateTables = null,
        strRunTests = null,
        strCleanUp = null,
        strCreateProc = null,
        strCreateResult = null,
        strDropResult = null,
        strLogLevel = null;
    String strTPCCRun = null, strTPCCLoad = null;
    BenchMain.bench = new BenchMain();
    bench.m_bInApplet = false;

    if (argv.length > 0)
      for (int nArg = 0; nArg < argv.length; nArg++) {
        if (argv[nArg].toUpperCase().startsWith("URL="))
          bench.m_strURL = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("USER="******"=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("PASSWORD="******"=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("DRIVER="))
          bench.m_strDriver = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("DRIVERTYPE="))
          bench.m_nDriverType =
              Integer.valueOf(argv[nArg].substring(argv[nArg].indexOf("=") + 1)).intValue();
        else if (argv[nArg].toUpperCase().startsWith("CREATETABLES="))
          strCreateTables = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("RUNTEST="))
          strRunTests = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("CLEANUP")) strCleanUp = argv[nArg];
        else if (argv[nArg].toUpperCase().startsWith("CREATEPROC")) strCreateProc = argv[nArg];
        else if (argv[nArg].toUpperCase().startsWith("CREATERESULT")) strCreateResult = argv[nArg];
        else if (argv[nArg].toUpperCase().startsWith("DROPRESULT")) strDropResult = argv[nArg];
        else if (argv[nArg].toUpperCase().startsWith("LOGLEVEL="))
          strLogLevel = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("TPCCRUN="))
          strTPCCRun = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
        else if (argv[nArg].toUpperCase().startsWith("TPCCLOAD="))
          strTPCCLoad = argv[nArg].substring(argv[nArg].indexOf("=") + 1);
      }
    bench.m_bInApplet = false;
    try {
      if (strCreateTables != null
          || strRunTests != null
          || strCleanUp != null
          || strCreateProc != null
          || strCreateResult != null
          || strDropResult != null
          || strTPCCRun != null
          || strTPCCLoad != null) {
        // batch
        TextProgress progress = new TextProgress();
        Bench.BenchPanel pane =
            new Bench.BenchPanel(
                bench.m_strDriver,
                bench.m_strURL,
                bench.m_strUserName,
                bench.m_strPassword,
                bench.m_nDriverType);
        Bench.Logger new_log =
            new Bench.Logger() {
              int m_nLogLevel = 0;

              public synchronized void log(String strMessage, int nLevel) {
                if (nLevel <= m_nLogLevel) System.out.print(strMessage);
              }

              public synchronized void taskDone() {
                notify();
              }

              public synchronized void waitOn() throws InterruptedException {
                wait();
              }

              public synchronized void setLogLevel(int nNewLogLevel) {
                m_nLogLevel = nNewLogLevel;
              }

              public synchronized int getLogLevel() {
                return m_nLogLevel;
              }
            };

        if (strLogLevel != null) new_log.setLogLevel(Integer.valueOf(strLogLevel).intValue());
        pane.setLogger(new_log);
        if (strCreateTables != null) {
          StringTokenizer createTokens = new StringTokenizer(strCreateTables, ",;/");
          int nBranchCount = 10, nTellerCount = 100, nAccountCount = 1000;
          if (createTokens.hasMoreTokens())
            nBranchCount = Integer.valueOf(createTokens.nextToken()).intValue();
          if (createTokens.hasMoreTokens())
            nTellerCount = Integer.valueOf(createTokens.nextToken()).intValue();
          if (createTokens.hasMoreTokens())
            nAccountCount = Integer.valueOf(createTokens.nextToken()).intValue();
          // FIXME               pane.setMaxTableLimits(nBranchCount,nTellerCount,nAccountCount);
          // FIXME               pane.doCreateTables(true,true,true,true,true,true,true,true);
        }
        // FIXME            if(strCreateProc != null)
        // pane.doLoadProcedures(pane.pool.getConnection(0));
        if (strRunTests != null) {
          int nNumThreads = 1, nNumRuns = 100, nTestType = 1, nWaitMinutes = -1;
          boolean bTrans = false, bQuery = true;
          StringTokenizer runTokens = new StringTokenizer(strRunTests, ",;/");
          if (runTokens.hasMoreTokens())
            nNumThreads = Integer.valueOf(runTokens.nextToken()).intValue();
          if (runTokens.hasMoreTokens())
            nNumRuns = Integer.valueOf(runTokens.nextToken()).intValue();
          if (runTokens.hasMoreTokens())
            bTrans = runTokens.nextToken().toUpperCase().equals("TRUE");
          if (runTokens.hasMoreTokens())
            bQuery = runTokens.nextToken().toUpperCase().equals("TRUE");
          if (runTokens.hasMoreTokens())
            nTestType = Integer.valueOf(runTokens.nextToken()).intValue();
          if (runTokens.hasMoreTokens())
            nWaitMinutes = Integer.valueOf(runTokens.nextToken()).intValue();
          // FIXME               pane.doRunTests(nNumThreads,nNumRuns,nWaitMinutes,nTestType ==
          // 1,nTestType == 2,nTestType == 3,bTrans,bQuery);
        }
        // FIXME            if(strCleanUp != null) pane.doCleanUp(pane.pool.getConnection(0),
        // true,true,true,true);
        if (strDropResult != null) pane.doDropResult();
        // FIXME            if(strCreateResult != null) pane.doCreateResult();
        // ========TPCCTest
        //            if(strTPCCLoad != null) {
        //               int n_ware = 1;
        //               StringTokenizer runTokens = new StringTokenizer(strTPCCLoad,",;/");
        //               //					System.out.println("tpcload = " + strTPCCLoad);
        //               if(runTokens.hasMoreTokens()) {
        //                  n_ware = Integer.valueOf(runTokens.nextToken()).intValue();
        //               //						System.out.println("N_ware = " + n_ware);
        //               }
        //               pane.doTpccLoadData(pane.pool.getConnection(0),
        // n_ware,Bench.TPCCBench.DIST_PER_WARE,Bench.TPCCBench.CUST_PER_DIST,Bench.TPCCBench.MAXITEMS,Bench.TPCCBench.ORD_PER_DIST);
        //            }
        //            if(strTPCCRun != null) {
        //               int n_rounds = 1, local_w_id = 1, n_ware = 1, n_threads = 1;
        //               StringTokenizer runTokens = new StringTokenizer(strTPCCRun,",;/");
        //               if(runTokens.hasMoreTokens())
        //                  n_rounds = Integer.valueOf(runTokens.nextToken()).intValue();
        //               if(runTokens.hasMoreTokens())
        //                  local_w_id = Integer.valueOf(runTokens.nextToken()).intValue();
        //               if(runTokens.hasMoreTokens())
        //                  n_ware = Integer.valueOf(runTokens.nextToken()).intValue();
        //               if(runTokens.hasMoreTokens())
        //                  n_threads = Integer.valueOf(runTokens.nextToken()).intValue();
        //               pane.doTpccRun(n_threads, n_rounds,local_w_id,n_ware);
        //            }
        pane.closeConnection(true);
        System.exit(0);
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
    // go interactive
    JFrame frame = new JFrame("JBench - Generic JDBC Benchmark Utility");
    WindowListener l =
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            BenchMain.bench.m_pane.closeConnection(true);
            System.exit(0);
          }
        };

    frame.addWindowListener(l);
    bench.m_parentFrame = frame;
    bench.init();
    frame.getContentPane().add(bench);
    frame.setSize(675, 400);
    frame.validate();
    frame.setVisible(true);
  }
  public void initUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      JPopupMenu.setDefaultLightWeightPopupEnabled(false);
      frame = new JFrame("Vestige-x Developers Client");
      frame.setIconImage(
          Toolkit.getDefaultToolkit().getImage(signlink.findcachedir() + "Cursor.png"));
      frame.setLayout(new BorderLayout());
      frame.setResizable(false);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      JPanel gamePanel = new JPanel();
      gamePanel.setLayout(new BorderLayout());
      gamePanel.add(this);
      Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
      int w = 765;
      int h = 503;
      int x = (dim.width - w) / 2;
      int y = (dim.height - h) / 2;
      frame.setLocation(x, y);
      gamePanel.setPreferredSize(new Dimension(765, 503));
      JMenu fileMenu = new JMenu("  File  ");
      JMenu toolMenu = new JMenu("  Tools  ");
      JMenu infoMenu = new JMenu("  Info  ");
      JMenu toggleMenu = new JMenu("  Toggles  ");
      JMenu profileMenu = new JMenu("  Links  ");
      JButton shotMenu = new JButton("Take Screenshot");
      shotMenu.setActionCommand("Screenshot");
      shotMenu.addActionListener(this);
      String[] mainButtons = new String[] {"View Images", "Exit"};
      String[] toolButtons = new String[] {"World Map"};
      String[] infoButtons = new String[] {"Client Information", "Support"};
      String[] toggleButtons = new String[] {"Toggle 10x Damage", "Untoggle 10x Damage"};
      String[] profileButtons =
          new String[] {"Donate", "Vote", "-", "Highscores", "Guides", "YouTube", "Forums"};

      for (String name : mainButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) {
          fileMenu.addSeparator();
        } else {
          menuItem.addActionListener(this);
          fileMenu.add(menuItem);
        }
      }
      for (String name : toolButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) toolMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          toolMenu.add(menuItem);
        }
      }

      for (String name : infoButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) infoMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          infoMenu.add(menuItem);
        }
      }
      for (String name : toggleButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) toggleMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          toggleMenu.add(menuItem);
        }
      }
      for (String name : profileButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) toggleMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          profileMenu.add(menuItem);
        }
      }
      JMenuBar menuBar = new JMenuBar();
      JMenuBar jmenubar = new JMenuBar();

      frame.add(jmenubar);
      menuBar.add(fileMenu);
      menuBar.add(toolMenu);
      menuBar.add(infoMenu);
      // menuBar.add(toggleMenu);
      menuBar.add(profileMenu);
      menuBar.add(shotMenu);
      frame.getContentPane().add(menuBar, BorderLayout.NORTH);
      frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
      frame.pack();

      frame.setVisible(true); // can see the client
      frame.setResizable(false); // resizeable frame
      init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  // The init method
  public void init() {

    // Set the look and feel
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      return;
    }

    // Create the menuListener
    MenuListener menuListener = new MenuListener();

    // Create the menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    // Create the file menu
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);

    // Create the menuitems
    JMenuItem menuItem;
    menuItem = new JMenuItem("Read Particle Location Data");
    fileMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    menuItem = new JMenuItem("Save Uintah Input File");
    fileMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    menuItem = new JMenuItem("Exit");
    fileMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    // Create the main tabbed pane
    mainTabbedPane = new JTabbedPane();

    // Create the panels to be added to the tabbed pane
    uintahInputPanel = new UintahInputPanel(d_partList, this);
    particleGenPanel = new ParticleGeneratePanel(d_partList, this);

    // Add the tabs
    mainTabbedPane.addTab("Uintah Inputs", null, uintahInputPanel, null);
    mainTabbedPane.addTab("Generate Particle Locations", null, particleGenPanel, null);
    mainTabbedPane.setSelectedIndex(0);
    getContentPane().add(mainTabbedPane);

    // Create the help menu
    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);

    // Create the menuitems
    menuItem = new JMenuItem("About");
    helpMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    // Create the invisible help frames
    helpAboutFrame = new HelpAboutFrame();
    helpAboutFrame.pack();

    // Create the Tab Listener
    TabListener tabListener = new TabListener();
    mainTabbedPane.addChangeListener(tabListener);
  }