Java Code Examples for javax.swing.JFrame

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project BMach, under directory /src/bmach/ui/gui/.

Source file: BMachPanel.java

  22 
vote

private void showAboutDialog(){
  JFrame frame=null;
  Container tla=this.getTopLevelAncestor();
  if (tla instanceof JFrame) {
    frame=(JFrame)tla;
  }
  new BMachAboutDialog(frame,true).setVisible(true);
}
 

Example 2

From project addis, under directory /application/src/test/java/org/drugis/addis/util/.

Source file: D80TableGeneratorTest.java

  19 
vote

public static void main(String[] args){
  JFrame window=new JFrame();
  JLabel pane=new JLabel();
  pane.setText(D80TableGenerator.getHtml(getExample()));
  window.add(pane);
  window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  window.pack();
  window.setVisible(true);
}
 

Example 3

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.

Source file: StartupWindow.java

  19 
vote

/** 
 * Get the startup window
 * @return the startup window singleton
 */
public static synchronized StartupWindow getInstance(){
  if (StartupWindow.instance == null) {
    JFrame frame=new JFrame(TITLE);
    boolean isModal=true;
    StartupWindow.instance=new StartupWindow(frame,TITLE,isModal);
  }
  return instance;
}
 

Example 4

From project Calendar-Application, under directory /com/toedter/calendar/.

Source file: JCalendar.java

  19 
vote

/** 
 * Creates a JFrame with a JCalendar inside and can be used for testing.
 * @param s The command line arguments
 */
public static void main(String[] s){
  JFrame frame=new JFrame("JCalendar");
  JCalendar jcalendar=new JCalendar();
  frame.getContentPane().add(jcalendar);
  frame.pack();
  frame.setVisible(true);
}
 

Example 5

From project Cinch, under directory /example/com/palantir/ptoss/cinch/example/dynamic/.

Source file: DynamicControls.java

  19 
vote

public static void main(String[] args) throws InterruptedException, InvocationTargetException {
  EventQueue.invokeAndWait(new Runnable(){
    public void run(){
      Examples.initializeLogging();
      DynamicControls example=new DynamicControls();
      JFrame frame=Examples.getFrameFor("Cinch Dynamic Controls Example",example.panel);
      frame.pack();
      frame.setVisible(true);
    }
  }
);
}
 

Example 6

From project BioMAV, under directory /Behavior/src/nl/ru/ai/projects/parrot/biomav/editor/.

Source file: BehaviorEditor.java

  18 
vote

public static void main(String[] args){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      JFrame mainFrame=new JFrame("Behavior Editor Test");
      BehaviorEditor be=new BehaviorEditor();
      mainFrame.add(be);
      mainFrame.pack();
      mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      mainFrame.setVisible(true);
    }
  }
);
}
 

Example 7

From project ceres, under directory /ceres-glayer/src/main/java/com/bc/ceres/glayer/tools/.

Source file: Tools.java

  18 
vote

private static void openFrame(LayerCanvas layerCanvas,String title,Rectangle bounds){
  final JFrame frame=new JFrame(title);
  frame.getContentPane().add(layerCanvas,BorderLayout.CENTER);
  frame.setBounds(bounds);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
}
 

Example 8

From project charts4j, under directory /src/test/java/com/googlecode/charts4j/example/.

Source file: SwingExample.java

  18 
vote

/** 
 * Display the chart in a swing window.
 * @param urlString the url string to display.
 * @throws IOException
 */
private static void displayUrlString(final String urlString) throws IOException {
  JFrame frame=new JFrame();
  JLabel label=new JLabel(new ImageIcon(ImageIO.read(new URL(urlString))));
  frame.getContentPane().add(label,BorderLayout.CENTER);
  frame.pack();
  frame.setVisible(true);
}
 

Example 9

From project Clotho-Core, under directory /ClothoApps/CollectionViewTool/src/org/clothocad/tool/collectionview/.

Source file: GlassMessage.java

  18 
vote

private static void createAndShowGUI(){
  JFrame f=new JFrame("Smooth Moves");
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.setSize(500,500);
  GlassMessage component=new GlassMessage("Failed to load part.",null,200,50,f,Color.WHITE,null);
  f.add(component);
  f.setVisible(true);
}
 

Example 10

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/.

Source file: NewExecutionListLauncherWindow.java

  18 
vote

private void enableImportWizard(boolean enable){
  JFrame mainFrame=ctxt.getMainFrame();
  if (mainFrame != null) {
    JMenuBar menuBar=mainFrame.getJMenuBar();
    activateMenu(menuBar,enable,"assistant","import");
  }
}
 

Example 11

From project contribution_eevolution_smart_browser, under directory /client/src/org/compiere/apps/.

Source file: APanel.java

  18 
vote

private void cmd_logout(){
  JFrame top=Env.getWindow(0);
  if (top instanceof AMenu) {
    ((AMenu)top).logout();
  }
}
 

Example 12

From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/calendar/.

Source file: JCalendar.java

  18 
vote

/** 
 * Creates a JFrame with a JCalendar inside and can be used for testing.
 */
static public void main(String[] s){
  JFrame frame=new JFrame("JCalendar");
  frame.getContentPane().add(new JCalendar());
  frame.pack();
  frame.setVisible(true);
}
 

Example 13

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swing/src/com/toedter/e4/ui/workbench/renderers/swing/.

Source file: WorkbenchWindowRenderer.java

  18 
vote

@Override public void createWidget(MUIElement element,MElementContainer<MUIElement> parent){
  if (element instanceof MWindow) {
    MWindow mWindow=(MWindow)element;
    JFrame jFrame=new JFrame();
    jFrame.getContentPane().setLayout(new BorderLayout());
    jFrame.setBounds(mWindow.getX(),mWindow.getY(),mWindow.getWidth(),mWindow.getHeight());
    jFrame.setTitle(mWindow.getLocalizedLabel());
    element.setWidget(jFrame);
    ((MWindow)element).getContext().set(JFrame.class,jFrame);
  }
}
 

Example 14

From project encog-java-examples, under directory /src/main/java/org/encog/examples/gui/elementary/.

Source file: ElementaryExample.java

  18 
vote

public static void main(String[] args){
  try {
    JFrame f=new ElementaryExample();
    f.setVisible(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
 

Example 15

From project Euclidean-Pattern-Generator, under directory /src/com/hisschemoller/sequencer/view/components/.

Source file: MainFrame.java

  18 
vote

public MainFrame(EPGSwingEngine swingEngine){
  JFrame jFrame=(JFrame)swingEngine.find(EPGSwingEngine.MAIN_FRAME);
  Dimension preferredSize=jFrame.getPreferredSize();
  jFrame.setSize(EPGPreferences.getInt(EPGPreferences.WINDOW_WIDTH,preferredSize.width),EPGPreferences.getInt(EPGPreferences.WINDOW_HEIGHT,preferredSize.height));
  jFrame.setLocation(EPGPreferences.getInt(EPGPreferences.WINDOW_X,0),EPGPreferences.getInt(EPGPreferences.WINDOW_Y,0));
  jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  jFrame.setVisible(true);
  jFrame.addComponentListener(this);
}
 

Example 16

From project freemind, under directory /freemind/accessories/plugins/time/.

Source file: JCalendar.java

  18 
vote

/** 
 * Creates a JFrame with a JCalendar inside and can be used for testing.
 * @param s The command line arguments
 */
public static void main(String[] s){
  JFrame frame=new JFrame("JCalendar");
  JCalendar jcalendar=new JCalendar();
  frame.getContentPane().add(jcalendar);
  frame.pack();
  frame.setVisible(true);
}
 

Example 17

From project glg2d, under directory /src/test/java/glg2d/.

Source file: GraphTest.java

  18 
vote

public static void main(String[] args) throws Exception {
  JFrame test=new GraphTest();
  test.setTitle("Graph Test");
  test.setPreferredSize(new Dimension(1024,768));
  test.pack();
  test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  test.setLocationRelativeTo(null);
  test.setVisible(true);
}
 

Example 18

From project Gmote, under directory /gmoteupdater/src/org/gmote/server/updater/.

Source file: ProgressDialog.java

  18 
vote

private static void makeFrame(){
  JFrame frame=new JFrame("Gmote Updater");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JComponent component=getInstance();
  component.setOpaque(true);
  frame.setContentPane(component);
  Toolkit toolkit=Toolkit.getDefaultToolkit();
  Dimension screenSize=toolkit.getScreenSize();
  frame.pack();
  int x=(screenSize.width - 200) / 2;
  int y=(screenSize.height - 200) / 2;
  frame.setLocation(x,y);
  frame.setVisible(true);
}
 

Example 19

From project Hotel-Management_MINF10-HCM, under directory /HotelManagement/src/main/java/core/datechooser/.

Source file: JCalendar.java

  18 
vote

/** 
 * Creates a JFrame with a JCalendar inside and can be used for testing.
 * @param s The command line arguments
 */
public static void main(String[] s){
  JFrame frame=new JFrame("JCalendar");
  JCalendar jcalendar=new JCalendar();
  frame.getContentPane().add(jcalendar);
  frame.pack();
  frame.setVisible(true);
}
 

Example 20

From project huiswerk, under directory /print/src/print/.

Source file: PrintStil.java

  18 
vote

public void preview(){
  JFrame frame=new JFrame();
  frame.add(new OpScherm());
  frame.setTitle("Preview van label 99014");
  frame.setSize(300,400);
  frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
  frame.setVisible(true);
}
 

Example 21

From project 3Dto2DApplet, under directory /src/java/nl/dannyarends/generator/model/.

Source file: Builder.java

  17 
vote

private static void createAndShowGUI(){
  frame=new JFrame("Model Builder");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JLabel label=new JLabel("Model Builder");
  frame.getContentPane().add(label);
  frame.pack();
  frame.setVisible(true);
}
 

Example 22

From project alg-vis, under directory /src/algvis/gui/.

Source file: AlgVisStandalone.java

  17 
vote

public static void main(String[] args){
  try {
    for (    LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
      if ("Nimbus".equals(info.getName())) {
        UIManager.put("nimbusBase",new Color(0xBB,0xC3,0xFF));
        UIManager.put("TitledBorder.position",TitledBorder.CENTER);
        UIManager.put("nimbusBlueGrey",new Color(0xD1,0xD1,0xD1));
        UIManager.put("control",new Color(0xFA,0xFA,0xFA));
        UIManager.setLookAndFeel(info.getClassName());
        break;
      }
    }
  }
 catch (  Exception e) {
  }
  JFrame f=new JFrame("Gnarley Trees");
  f.addWindowListener(new java.awt.event.WindowAdapter(){
    @Override public void windowClosing(    java.awt.event.WindowEvent e){
      System.exit(0);
    }
  }
);
  AlgVis A=new AlgVis(f.getRootPane());
  A.setSize(WIDTH,HEIGHT);
  f.getContentPane().add(A);
  f.pack();
  A.init();
  f.setSize(WIDTH,HEIGHT + 20);
  f.setVisible(true);
}
 

Example 23

From project BoneJ, under directory /src/org/bonej/.

Source file: Help.java

  17 
vote

private void showAbout(){
  JEditorPane htmlPane=new JEditorPane("text/html","<html>\n" + "  <body>\n" + "<p><b>BoneJ version " + bonejVersion + "</b>	</p>"+ "<p>BoneJ is an ImageJ plugin designed for (but not limited to) bone image analysis.</p>"+ "<p>User and developer documentation can be found at <a href=http://bonej.org/>bonej.org</a></p>"+ "\n"+ "  </body>\n"+ "</html>");
  htmlPane.setEditable(false);
  htmlPane.setOpaque(false);
  htmlPane.addHyperlinkListener(new HyperlinkListener(){
    public void hyperlinkUpdate(    HyperlinkEvent e){
      if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType()))       try {
        BrowserLauncher.openURL(e.getURL().toString());
      }
 catch (      IOException exception) {
      }
    }
  }
);
  JPanel panel=new JPanel(new BorderLayout());
  panel.add(htmlPane,BorderLayout.CENTER);
  final JFrame frame=new JFrame("About BoneJ...");
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.getContentPane().add(panel,BorderLayout.CENTER);
  frame.pack();
  frame.setVisible(true);
}
 

Example 24

From project codjo-control, under directory /codjo-control-gui/src/test/java/net/codjo/control/gui/plugin/.

Source file: DefaultQuarantineDetailWindowTest.java

  17 
vote

public static void main(String[] args) throws Exception {
  DetailDataSource dataSourceChiotte=getDataSourceChiotte(0);
  DefaultQuarantineDetailWindow window=new DefaultQuarantineDetailWindow(dataSourceChiotte);
  assertEquals("Quarantaine des benchs",window.getTitle());
  JFrame frame=new JFrame("Test Renderer");
  frame.getContentPane().add(window.getMainTabbedPane());
  frame.pack();
  frame.setVisible(true);
  frame.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent evt){
      System.exit(0);
    }
  }
);
}
 

Example 25

From project des, under directory /daemon/lib/apache-log4j-1.2.16/contribs/CekiGulcu/.

Source file: AppenderTable.java

  17 
vote

static public void main(String[] args){
  if (args.length != 2) {
    System.err.println("Usage: java AppenderTable bufferSize runLength\n" + "  where bufferSize is the size of the cyclic buffer in the TableModel\n" + "  and runLength is the total number of elements to add to the table in\n"+ "  this test run.");
    return;
  }
  JFrame frame=new JFrame("JTableAppennder test");
  Container container=frame.getContentPane();
  AppenderTable tableAppender=new AppenderTable();
  int bufferSize=Integer.parseInt(args[0]);
  AppenderTableModel model=new AppenderTableModel(bufferSize);
  tableAppender.setModel(model);
  int runLength=Integer.parseInt(args[1]);
  JScrollPane sp=new JScrollPane(tableAppender);
  sp.setPreferredSize(new Dimension(250,80));
  container.setLayout(new BoxLayout(container,BoxLayout.X_AXIS));
  container.add(sp);
  JButton button=new JButton("ADD");
  container.add(button);
  button.addActionListener(new JTableAddAction(tableAppender));
  frame.setSize(new Dimension(500,300));
  frame.setVisible(true);
  long before=System.currentTimeMillis();
  int i=0;
  while (i++ < runLength) {
    LoggingEvent event=new LoggingEvent("x",logger,Level.ERROR,"Message " + i,null);
    tableAppender.doAppend(event);
  }
  long after=System.currentTimeMillis();
  long totalTime=(after - before);
  System.out.println("Total time :" + totalTime + " milliseconds for "+ "runLength insertions.");
  System.out.println("Average time per insertion :" + (totalTime * 1000 / runLength) + " micro-seconds.");
}
 

Example 26

From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/broker/ui/.

Source file: BrokerWindow.java

  17 
vote

private JFrame buildFrame(final Collection<Company> companies,boolean exitOnClose){
  JPanel contentPanel=new JPanel(new BorderLayout());
  JPanel companyListPanel=new JPanel(new GridLayout(0,2));
  for (  Company company : companies) {
    CompanyPanel panel=new CompanyPanel(company);
    this.companies.put(company.getSymbol(),panel);
    companyListPanel.add(panel);
  }
  contentPanel.add(companyListPanel,BorderLayout.WEST);
  contentPanel.add(logPanel,BorderLayout.CENTER);
  contentPanel.add(banner,BorderLayout.SOUTH);
  JFrame frame=new JFrame();
  frame.setContentPane(contentPanel);
  frame.setDefaultCloseOperation(exitOnClose ? JFrame.EXIT_ON_CLOSE : JFrame.DISPOSE_ON_CLOSE);
  frame.setTitle("Drools Fusion Example: Simple Broker");
  frame.setResizable(true);
  frame.pack();
  frame.setLocationRelativeTo(null);
  Thread bannerThread=new Thread(banner);
  bannerThread.setPriority(bannerThread.getPriority() - 1);
  bannerThread.start();
  return frame;
}
 

Example 27

From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/.

Source file: BuildViewWhenReadyComponent.java

  17 
vote

public static void main(String[] args) throws InterruptedException {
  JFrame frame=new JFrame();
  JPanel panel=new JPanel(new BorderLayout());
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  ViewBuilder builder=new ViewBuilder(){
    public JComponent buildPanel(){
      return new JLabel("Ok, time for coffee!");
    }
  }
;
  ValueModel readyModel=new ValueHolder(false);
  panel.add(new JLabel("It's supposed to be doing that"),BorderLayout.NORTH);
  panel.add(new BuildViewWhenReadyComponent(builder,readyModel,"Please wait while I sleep"),BorderLayout.CENTER);
  frame.add(panel);
  frame.pack();
  frame.setVisible(true);
  Random gen=new Random();
  for (int i=0; i < 100; ++i) {
    Thread.sleep(gen.nextInt(500));
    readyModel.setValue(gen.nextBoolean());
  }
  System.exit(0);
}
 

Example 28

From project encog-java-core, under directory /src/test/java/org/encog/neural/data/image/.

Source file: TestImageDataSet.java

  17 
vote

public void testImageDataSet(){
  try {
    JFrame frame=new JFrame();
    frame.setVisible(true);
    Image image=frame.createImage(10,10);
    Graphics g=image.getGraphics();
    g.setColor(Color.BLACK);
    g.fillRect(0,0,10,10);
    g.setColor(Color.WHITE);
    g.fillRect(0,0,5,5);
    g.dispose();
    Downsample downsample=new SimpleIntensityDownsample();
    ImageMLDataSet set=new ImageMLDataSet(downsample,true,-1,1);
    BasicMLData ideal=new BasicMLData(1);
    ImageMLData input=new ImageMLData(image);
    set.add(input,ideal);
    set.downsample(2,2);
    Iterator<MLDataPair> itr=set.iterator();
    MLDataPair pair=(MLDataPair)itr.next();
    MLData data=pair.getInput();
    double[] d=data.getData();
    input.toString();
    input.setImage(input.getImage());
  }
 catch (  HeadlessException ex) {
  }
}
 

Example 29

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/bom/.

Source file: RadioButtonTreeCellRenderer.java

  17 
vote

public static void main(String[] args){
  DefaultMutableTreeNode root=new DefaultMutableTreeNode("root");
  DefaultMutableTreeNode one=new DefaultMutableTreeNode("one");
  DefaultMutableTreeNode two=new DefaultMutableTreeNode("two");
  DefaultMutableTreeNode three=new DefaultMutableTreeNode("three");
  root.add(one);
  root.add(two);
  root.add(three);
  RadioButtonTreeCellRenderer m_RadioButtonTreeCellRenderer=new RadioButtonTreeCellRenderer();
  final CheckboxTree tree=new CheckboxTree(m_RadioButtonTreeCellRenderer.action_loadBOM(null,false));
  tree.getCheckingModel().setCheckingMode(it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingModel.CheckingMode.SIMPLE);
  tree.getCheckingModel().clearChecking();
  tree.setCellRenderer(m_RadioButtonTreeCellRenderer);
  tree.addTreeCheckingListener(new TreeCheckingListener(){
    public void valueChanged(    TreeCheckingEvent e){
      log.fine("Checked paths changed: user clicked on " + (e.getLeadingPath().getLastPathComponent()));
    }
  }
);
  JFrame frame=new JFrame("RadioButton tree");
  frame.add(tree);
  tree.expandAll();
  frame.pack();
  frame.setVisible(true);
}
 

Example 30

From project flyingsaucer, under directory /flying-saucer-examples/src/main/java/org/xhtmlrenderer/demo/aboutbox/.

Source file: AboutBox.java

  17 
vote

/** 
 * The main program for the AboutBox class
 * @param args The command line arguments
 */
public static void main(String[] args){
  JFrame frame=new JFrame("About Box Test");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JButton launch=new JButton("Show About Box");
  frame.getContentPane().add(launch);
  frame.pack();
  frame.setVisible(true);
  launch.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      AboutBox ab=new AboutBox("About Flying Saucer","demo:demos/index.xhtml");
      ab.setVisible(true);
    }
  }
);
}
 

Example 31

From project formic, under directory /src/java/org/formic/wizard/impl/gui/.

Source file: GuiWizard.java

  17 
vote

/** 
 * {@inheritDoc}
 * @see org.pietschy.wizard.Wizard#showInFrame(String,Image)
 */
public void showInFrame(String title,Image image){
  JFrame window=new JFrame(title);
  Dimension dimension=Installer.getDimension();
  window.setMinimumSize(dimension);
  window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  window.setIconImage(image);
  ((RootPaneContainer)window).getContentPane().add(this);
  window.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      getCancelAction().actionPerformed(null);
    }
  }
);
  WizardFrameCloser.bind(this,window);
  window.setLocationRelativeTo(null);
  window.setVisible(true);
  window.toFront();
  window.setSize(dimension);
  window.pack();
}
 

Example 32

From project gephi-toolkit-demos, under directory /src/org/gephi/toolkit/demos/.

Source file: PreviewJFrame.java

  17 
vote

public void script(){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.newProject();
  Workspace workspace=pc.getCurrentWorkspace();
  ImportController importController=Lookup.getDefault().lookup(ImportController.class);
  Container container;
  try {
    File file=new File(getClass().getResource("/org/gephi/toolkit/demos/resources/Java.gexf").toURI());
    container=importController.importFile(file);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    return;
  }
  importController.process(container,new DefaultProcessor(),workspace);
  PreviewController previewController=Lookup.getDefault().lookup(PreviewController.class);
  PreviewModel previewModel=previewController.getModel();
  previewModel.getProperties().putValue(PreviewProperty.SHOW_NODE_LABELS,Boolean.TRUE);
  previewModel.getProperties().putValue(PreviewProperty.NODE_LABEL_COLOR,new DependantOriginalColor(Color.WHITE));
  previewModel.getProperties().putValue(PreviewProperty.EDGE_CURVED,Boolean.FALSE);
  previewModel.getProperties().putValue(PreviewProperty.EDGE_OPACITY,50);
  previewModel.getProperties().putValue(PreviewProperty.EDGE_RADIUS,10f);
  previewModel.getProperties().putValue(PreviewProperty.BACKGROUND_COLOR,Color.BLACK);
  previewController.refreshPreview();
  ProcessingTarget target=(ProcessingTarget)previewController.getRenderTarget(RenderTarget.PROCESSING_TARGET);
  PApplet applet=target.getApplet();
  applet.init();
  previewController.render(target);
  target.refresh();
  target.resetZoom();
  JFrame frame=new JFrame("Test Preview");
  frame.setLayout(new BorderLayout());
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.add(applet,BorderLayout.CENTER);
  frame.pack();
  frame.setVisible(true);
}
 

Example 33

From project gnupg-for-java, under directory /src/java/com/freiheit/gnupg/.

Source file: GnuPGPassphraseWindow.java

  17 
vote

/** 
 * Use this, if you use this library from a swing application.
 * @param f where this passphrase dialog should be modal to.(See Swing-Documentation, if you don't know, what modal dialogs are!)
 */
public GnuPGPassphraseWindow(JFrame f){
  if (f != null) {
    _win=f;
    _internalWin=false;
  }
 else {
    _win=new JFrame("GnuPG for Java - freiheit.com technologies gmbh, 2004");
    _internalWin=true;
  }
}
 

Example 34

From project gridland, under directory /agents/agents/.

Source file: Reaper.java

  17 
vote

@Override public void initialize(){
  arena=map.getArena(6);
  if (System.getProperty("reaper") != null) {
    view=new SwingView(24);
    view.setBasePallette(new SwingView.HeatPalette(32));
    window=new JFrame("Agent " + getId());
    window.setContentPane(view);
    window.setSize(view.getPreferredSize(arena));
    window.setVisible(true);
  }
}
 

Example 35

From project gs-algo, under directory /src/org/graphstream/algorithm/measure/.

Source file: ChartMeasure.java

  17 
vote

/** 
 * Output some charts according to a set of parameters. Actually, only one chart is supported. According to  {@link PlotParameters#outputType}, plot is displayed on screen or saved in a file.
 * @param params parameters used to plot
 * @param charts charts to output
 * @throws PlotException
 */
public static void outputPlot(PlotParameters params,JFreeChart... charts) throws PlotException {
  if (charts == null || charts.length == 0)   throw new PlotException("no chart");
  if (charts.length > 1)   throw new PlotException("multiple charts not yet supported");
  JFreeChart chart=charts[0];
switch (params.outputType) {
case SCREEN:
    ChartPanel panel=new ChartPanel(chart,params.width,params.height,params.width,params.height,params.width + 50,params.height + 50,true,true,true,true,true,true);
  JFrame frame=new JFrame(params.title);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.add(panel);
frame.pack();
frame.setVisible(true);
break;
case JPEG:
try {
ChartUtilities.saveChartAsJPEG(new File(params.path),chart,params.width,params.height);
}
 catch (IOException e) {
throw new PlotException(e);
}
break;
case PNG:
try {
ChartUtilities.saveChartAsPNG(new File(params.path),chart,params.width,params.height);
}
 catch (IOException e) {
throw new PlotException(e);
}
break;
}
}
 

Example 36

From project hanoitowers-piqle, under directory /src/environment/.

Source file: AbstractEnvironmentSingle.java

  17 
vote

public void setGraphics(){
  graf=new JFrame();
  graf.setSize(new Dimension(300,300));
  graf.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      System.out.println("On quitte");
      System.exit(0);
    }
  }
);
  graf.getContentPane().setLayout(new BoxLayout(graf.getContentPane(),BoxLayout.Y_AXIS));
  graf.getContentPane().add(defaultText);
  graf.setVisible(true);
}
 

Example 37

From project harmony, under directory /harmony.ui.topologygui/src/main/java/org/opennaas/ui/topology/.

Source file: TopologyClient.java

  17 
vote

/** 
 * This method initializes jFrame
 * @return javax.swing.JFrame
 */
JFrame getJFrame(){
  if (this.jFrame == null) {
    this.jFrame=new JFrame();
    this.jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.jFrame.setJMenuBar(this.getJJMenuBar());
    this.jFrame.setSize(800,600);
    this.jFrame.setContentPane(this.getJSplitPane());
    this.jFrame.setTitle("Phosphorus Topology Client");
    this.jFrame.setLocation(50,50);
  }
  return this.jFrame;
}
 

Example 38

From project ib-ruby, under directory /misc/IBController 2-9-0/src/ibcontroller/.

Source file: ConfigureApiTask.java

  17 
vote

private void configureIt(){
  JFrame jf=TwsListener.getMainWindow();
  if (jf == null) {
    System.err.println("IBControllerServer: could not find main window to configure API");
    mChannel.writeNack("main window not found");
    return;
  }
  Utils.logToConsole("Attempting to configure API");
  JMenuItem jmi=Utils.findMenuItem(jf,new String[]{"Configure","API","Enable ActiveX and Socket Clients"});
  if (jmi != null) {
    configureItViaConfigureMenu((JCheckBoxMenuItem)jmi);
  }
 else {
    jmi=Utils.findMenuItem(jf,new String[]{"Edit","Global Configuration..."});
    if (jmi != null) {
      configureItViaEditMenu(jmi);
    }
 else {
      System.err.println("IBControllerServer: could not find Configure > API > Enable ActiveX or Edit > Global Configuration menus");
      mChannel.writeNack("Configure > API > Enable ActiveX or Edit > Global Configuration menus not found");
    }
  }
}
 

Example 39

From project CloudReports, under directory /src/main/java/cloudreports/database/.

Source file: Database.java

  16 
vote

/** 
 * Creates a brand new database.
 * @see #connection
 * @since   1.0
 */
public static void createDatabase(){
  try {
    establishConnection();
    Statement stat=connection.createStatement();
    createCustomersTable(stat);
    createDatacentersTable(stat);
    createHostsTable(stat);
    createSanStorageTable(stat);
    createUtilizationProfilesTable(stat);
    createVirtualMachinesTable(stat);
    createNetworkMapTable(stat);
    createReportDataTable(stat);
    createMigrationsTable(stat);
    createSettingsTable(stat);
    createRandomPoolTable(stat);
    insertDefaultSettingsValues(stat);
  }
 catch (  Exception ex) {
    Dialog.showErrorMessage(new JFrame(),"An error occurred while creating the database.");
    System.exit(0);
  }
 finally {
    closeConnection(connection);
  }
}
 

Example 40

From project gs-core, under directory /src/org/graphstream/ui/swingViewer/.

Source file: DefaultView.java

  16 
vote

@Override public void openInAFrame(boolean on){
  if (on) {
    if (frame == null) {
      frame=new JFrame("GraphStream");
      frame.setLayout(new BorderLayout());
      frame.add(this,BorderLayout.CENTER);
      frame.setSize(800,600);
      frame.setVisible(true);
      frame.addWindowListener(this);
      frame.addKeyListener(shortcuts);
    }
 else {
      frame.setVisible(true);
    }
  }
 else {
    if (frame != null) {
      frame.removeWindowListener(this);
      frame.removeKeyListener(shortcuts);
      frame.remove(this);
      frame.setVisible(false);
      frame.dispose();
    }
  }
}
 

Example 41

From project Holo-Edit, under directory /holoedit/gui/.

Source file: FloatingWindow.java

  16 
vote

public FloatingWindow(String title,HoloEdit owner,int sizeW,int sizeH,int posiX,int posiY,boolean visi){
  super(title);
  mr=owner;
  osizW=sizW=sizeW;
  osizH=sizH=sizeH;
  oposX=posX=posiX;
  oposY=posY=posiY;
  visible=visi;
  jrp=getRootPane();
  jrp.setLayout(new BorderLayout());
  jrp.setFocusable(false);
  pan=new JPanel();
  pan.setVisible(true);
  pan.setFocusable(false);
  pan.setLayout(new BorderLayout());
  statusBar=new JLabel();
  statusBar.setFont(statusBar.getFont().deriveFont(10f));
  statusBar.setVisible(true);
  JPanel jp=new JPanel();
  jp.setLayout(new BorderLayout());
  jp.add(statusBar,BorderLayout.WEST);
  add(jp,BorderLayout.SOUTH);
  jrp.add(pan,BorderLayout.CENTER);
  setJMenuBar(Ut.barMenu);
  setResizable(false);
  setSize(sizW,sizH);
  setLocation(posX,posY);
  setFocusable(true);
  addFocusListener(this);
  setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  addWindowListener(this);
  addComponentListener(this);
}
 

Example 42

From project Agot-Java, under directory /src/main/java/got/ui/.

Source file: JDialogAdapter.java

  15 
vote

public JDialogAdapter(JFrame owner){
  super(owner);
  this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
  createComponent();
  layoutCoponents();
  setupListeners();
}
 

Example 43

From project ant4eclipse, under directory /org.ant4eclipse.lib.core.test/src/org/ant4eclipse/lib/core/.

Source file: AssureTest.java

  15 
vote

@Test public void instanceOf(){
  Assure.instanceOf("parameter","",String.class);
  try {
    Assure.instanceOf("parameter",new Object(),String.class);
  }
 catch (  Ant4EclipseException ex) {
    Assert.assertEquals(CoreExceptionCode.PRECONDITION_VIOLATION,ex.getExceptionCode());
  }
  try {
    Assure.instanceOf("parameter",null,JFrame.class);
  }
 catch (  Ant4EclipseException ex) {
    Assert.assertEquals(CoreExceptionCode.PRECONDITION_VIOLATION,ex.getExceptionCode());
  }
}
 

Example 44

From project CBCJVM, under directory /cbc/CBCJVM/src/cbccore/low/.

Source file: CBCSimulator.java

  15 
vote

public CBCSimulator(){
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception e) {
    System.out.println("Error setting native LAF: " + e);
  }
  cbob=new SimulatedCBOB(this);
  sound=new SimulatedSound(this);
  sensor=new SimulatedSensor(this);
  device=new SimulatedDevice(this);
  display=new SimulatedDisplay(this);
  input=new SimulatedInput(this);
  servo=new SimulatedServo(this);
  motor=new SimulatedMotor(this);
  camera=new SimulatedCamera(this);
  create=new SimulatedCreate(this);
  for (int i=0; i < motorSpeedLabels.length; ++i) {
    motorSpeedLabels[i]=new JLabel();
  }
  if (stdOut == null) {
    stdOut=System.out;
  }
  System.out.println("Welcome to CBCJava");
  frame.getContentPane().add(new JScrollPane(display.getTextBox()),BorderLayout.CENTER);
  System.setOut(display.getPrintStream());
  addSidebar();
  addMotorLabels();
  addButtons();
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  frame.setSize(Math.min(1024,(int)(screenSize.width * .7)),Math.min(768,(int)(screenSize.height * .7)));
  frame.setVisible(true);
  new MotorSpeedUpdater(this,100).start();
}
 

Example 45

From project collaborative-editor, under directory /mpedit/gui/.

Source file: CDialogTemplate.java

  15 
vote

protected void init(){
  getContentPane().setLayout(new BorderLayout());
  this.setResizable(false);
  JPanel panel_buttons=this.drawButtonPanel();
  getContentPane().add(panel_buttons,BorderLayout.SOUTH);
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setLocation((int)(Toolkit.getDefaultToolkit().getScreenSize().width / 4),(int)(Toolkit.getDefaultToolkit().getScreenSize().height / 4));
}
 

Example 46

From project datavalve, under directory /samples/swingDemo/src/main/java/org/fluttercode/datavalve/samples/swingdemo/.

Source file: Main.java

  15 
vote

public static void main(String[] args){
  Main main=new Main();
  main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  main.setSize(300,300);
  main.setVisible(true);
  main.setTitle("IndexedDataProviderCache demo");
}
 

Example 47

From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.

Source file: DefaultImageView.java

  15 
vote

private void showHistogram(){
  Rectangle rec=imageComponent.selectedArea;
  if (isTrueColor) {
    toolkit.beep();
    JOptionPane.showMessageDialog(this,"Unsupported operation: unable to draw histogram for true color image.",getTitle(),JOptionPane.ERROR_MESSAGE);
    return;
  }
  if ((rec == null) || (rec.getWidth() <= 0) || (rec.getHeight() <= 0)) {
    toolkit.beep();
    JOptionPane.showMessageDialog(this,"No data for histogram.\nUse Shift+Mouse_drag to select an image area.",getTitle(),JOptionPane.ERROR_MESSAGE);
    return;
  }
  double chartData[][]=new double[1][256];
  for (int i=0; i < 256; i++) {
    chartData[0][i]=0.0;
  }
  int w=dataset.getWidth();
  int x0=(int)(rec.x / zoomFactor);
  int y0=(int)(rec.y / zoomFactor);
  int x=x0 + (int)(rec.width / zoomFactor);
  int y=y0 + (int)(rec.height / zoomFactor);
  int arrayIndex=0;
  for (int i=y0; i < y; i++) {
    for (int j=x0; j < x; j++) {
      arrayIndex=(int)imageByteData[i * w + j];
      if (arrayIndex < 0) {
        arrayIndex+=256;
      }
      chartData[0][arrayIndex]+=1.0;
    }
  }
  double[] xRange=originalRange;
  if (xRange == null || xRange[0] == xRange[1]) {
    xRange=new double[2];
    Tools.findMinMax(data,xRange,null);
  }
  Chart cv=new Chart((JFrame)viewer,"Histogram - " + dataset.getPath() + dataset.getName()+ " - by pixel index",Chart.HISTOGRAM,chartData,xRange,null);
  cv.setVisible(true);
}
 

Example 48

From project dolphin, under directory /org.adarsh.jutils/src/.

Source file: Main.java

  15 
vote

private void initComponent(){
  b1=new JButton("go");
  this.setBounds(300,400,200,100);
  b1.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      final String cp=System.getProperty("java.class.path").toLowerCase();
      if (cp.indexOf("jutils") >= 0 && cp.endsWith(".jar")) {
        final File file=new File(linksDir,"mypllugins.txt");
        if (!file.exists() && file.length() <= 0) {
          if (linksDir.exists() || linksDir.mkdirs()) {
            write(content,file);
          }
        }
        if (pluginDir.exists() || pluginDir.mkdirs()) {
          final String command="CMD /c COPY /Y \"" + new File(cp).getAbsolutePath() + "\" \""+ path+ "\\jutils.jar\"";
          final File destFile=new File(path,"jutils.jar");
          if (destFile.exists() && destFile.delete()) {
            exec(command);
            log(command);
          }
          if (destFile.exists()) {
            exec("explorer /select, \"" + destFile + "\"");
            log("explorer /select, \"" + destFile + "\"");
          }
        }
      }
    }
  }
);
  this.add(b1);
  this.setVisible(true);
  this.setTitle("Jutils create by tyj");
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 

Example 49

From project empire-db, under directory /empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/.

Source file: ClientGUI.java

  15 
vote

/** 
 * This method initializes this
 */
private void initialize(){
  this.setSize(529,299);
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setContentPane(getJContentPane());
  this.setTitle("Employee Management Client");
  this.setLocationRelativeTo(null);
}
 

Example 50

From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/dialogs/select/.

Source file: SelectDialog.java

  15 
vote

/** 
 * Construct the selection dialog box.
 * @param owner The owner of the dialog box.
 * @param choiceList The choices.
 */
public SelectDialog(final JFrame owner,final List<SelectItem> choiceList){
  super(owner);
  final Container content=this.getBodyPanel();
  this.choiceList=choiceList;
  this.setSize(500,250);
  this.setLocation(50,100);
  setTitle("Select");
  content.setLayout(new GridLayout(1,2));
  content.add(this.scroll1);
  content.add(this.scroll2);
  for (  SelectItem item : this.choiceList) {
    this.model.addElement(item.getText());
  }
  this.list.addListSelectionListener(this);
  this.text.setLineWrap(true);
  this.text.setWrapStyleWord(true);
  this.text.setEditable(false);
  scroll2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}
 

Example 51

From project FBReaderJ, under directory /obsolete/swing/src/org/geometerplus/zlibrary/ui/swing/dialogs/.

Source file: ZLSwingDialog.java

  15 
vote

public ZLSwingDialog(JFrame frame,ZLResource resource){
  super();
  myTab=new ZLSwingDialogContent(resource);
  myDialog=new JDialog(frame);
  myDialog.setTitle(resource.getResource(ZLDialogManager.DIALOG_TITLE).getValue());
  final String optionGroupName=resource.Name;
  myWidthOption=new ZLIntegerRangeOption(ZLOption.LOOK_AND_FEEL_CATEGORY,optionGroupName,"Width",10,2000,485);
  myHeightOption=new ZLIntegerRangeOption(ZLOption.LOOK_AND_FEEL_CATEGORY,optionGroupName,"Height",10,2000,332);
}
 

Example 52

From project FML, under directory /common/cpw/mods/fml/relauncher/.

Source file: Downloader.java

  15 
vote

public JDialog makeDialog(){
  setMessageType(JOptionPane.INFORMATION_MESSAGE);
  setMessage(makeProgressPanel());
  setOptions(new Object[]{"Stop"});
  addPropertyChangeListener(new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent evt){
      if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) {
        requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
      }
    }
  }
);
  container=new JDialog(null,"Hello",ModalityType.MODELESS);
  container.setResizable(false);
  container.setLocationRelativeTo(null);
  container.add(this);
  this.updateUI();
  container.pack();
  container.setMinimumSize(container.getPreferredSize());
  container.setVisible(true);
  container.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  container.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
    }
  }
);
  return container;
}
 

Example 53

From project gitblit, under directory /src/com/gitblit/client/.

Source file: GitblitManager.java

  15 
vote

private void initialize(){
  setContentPane(getCenterPanel());
  setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());
  setTitle("Gitblit Manager v" + Constants.VERSION + " ("+ Constants.VERSION_DATE+ ")");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent event){
      saveSizeAndPosition();
    }
    @Override public void windowOpened(    WindowEvent event){
      manageRegistrations();
    }
  }
);
  setSizeAndPosition();
  loadRegistrations();
  rebuildRecentMenu();
}
 

Example 54

From project GraphWalker, under directory /src/main/java/org/graphwalker/GUI/.

Source file: App.java

  15 
vote

private App(){
  logger=Util.setupLogger(App.class);
  mbt=new ModelBasedTesting();
  init();
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  pack();
  setLocationByPlatform(true);
  setVisible(true);
  updateLayout();
}
 

Example 55

From project groovejaar, under directory /src/groovejaar/.

Source file: LyricsGui.java

  15 
vote

/** 
 * Create the frame.
 */
public LyricsGui(String text){
  setTitle("Lyrics");
  this.setIconImage(new ImageUtil().getLogo());
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setBounds(100,100,560,343);
  contentPane=new JPanel();
  contentPane.setBorder(new EmptyBorder(5,5,5,5));
  setContentPane(contentPane);
  JTextArea txtrTexthtml=new JTextArea();
  txtrTexthtml.setEditable(false);
  txtrTexthtml.setLineWrap(true);
  txtrTexthtml.setRows(8);
  JScrollPane scrollingResult=new JScrollPane(txtrTexthtml);
  JLabel lblLyric=new JLabel("Lyric (maybe this can be a wrong lyric, take care!):");
  lblLyric.setFont(new Font("Tahoma",Font.BOLD,11));
  txtrTexthtml.setText(" " + text.replaceAll("<br />,","\n"));
  GroupLayout gl_contentPane=new GroupLayout(contentPane);
  gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane.createSequentialGroup().addGap(10).addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING).addComponent(scrollingResult,Alignment.LEADING).addComponent(lblLyric,Alignment.LEADING,GroupLayout.DEFAULT_SIZE,404,Short.MAX_VALUE)).addGap(10)));
  gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane.createSequentialGroup().addGap(11).addComponent(lblLyric).addPreferredGap(ComponentPlacement.RELATED).addComponent(scrollingResult,GroupLayout.DEFAULT_SIZE,224,Short.MAX_VALUE)));
  contentPane.setLayout(gl_contentPane);
}
 

Example 56

From project HMS, under directory /src/main/java/com/uff/hmstpa/vision/frames/.

Source file: CreateScheduleFrame.java

  15 
vote

public CreateScheduleFrame(JFrame mainFrame,CreateScheduleCommand cmd){
  this.mainFrame=mainFrame;
  this.createCmd=cmd;
  try {
    for (    javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
      if ("Nimbus".equals(info.getName())) {
        javax.swing.UIManager.setLookAndFeel(info.getClassName());
        break;
      }
    }
  }
 catch (  ClassNotFoundException ex) {
    java.util.logging.Logger.getLogger(CreateScheduleFrame.class.getName()).log(java.util.logging.Level.SEVERE,null,ex);
  }
catch (  InstantiationException ex) {
    java.util.logging.Logger.getLogger(CreateScheduleFrame.class.getName()).log(java.util.logging.Level.SEVERE,null,ex);
  }
catch (  IllegalAccessException ex) {
    java.util.logging.Logger.getLogger(CreateScheduleFrame.class.getName()).log(java.util.logging.Level.SEVERE,null,ex);
  }
catch (  javax.swing.UnsupportedLookAndFeelException ex) {
    java.util.logging.Logger.getLogger(CreateScheduleFrame.class.getName()).log(java.util.logging.Level.SEVERE,null,ex);
  }
  this.initComponents();
  this.setVisible(false);
  this.setLocationRelativeTo(null);
}