Java Code Examples for java.awt.Frame

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 autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.

Source file: Case.java

  22 
vote

private static void doCaseNameChange(String newCaseName){
  if (!newCaseName.equals("")) {
    Frame f=WindowManager.getDefault().getMainWindow();
    f.setTitle(newCaseName + " - " + Case.getAppName());
  }
}
 

Example 2

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.specmol/src/net/bioclipse/specmol/editor/.

Source file: SpecMolPeackChartComposite.java

  22 
vote

/** 
 * initializes the composite by creating and adding a peak chart
 * @param AssignmentPage page 
 */
private void init(AssignmentPage page){
  GridLayout layout=new GridLayout();
  this.setLayout(layout);
  GridData layoutData=new GridData(GridData.FILL_BOTH);
  this.setLayoutData(layoutData);
  Frame fileTableFrame=SWT_AWT.new_Frame(this);
  fileTableFrame.setLayout(new BorderLayout());
  chart=SpectrumChartFactory.createPeakChart(null,null,null);
  chart.setTitle("empty chart");
  chartPanel=new SpokChartPanel(chart,"peak",null,null);
  fileTableFrame.add(chartPanel,BorderLayout.CENTER);
  chartPanel.addMouseListener(page.getPeakChartCompositeMouseListener());
}
 

Example 3

From project BMach, under directory /src/jsyntaxpane/actions/.

Source file: ActionUtils.java

  22 
vote

/** 
 * Returns the Frame that contains this component or null if the component is not within a Window or the containing window is not a frame
 * @param comp
 * @return
 */
public static Frame getFrameFor(Component comp){
  Window w=SwingUtilities.getWindowAncestor(comp);
  if (w != null && w instanceof Frame) {
    Frame frame=(Frame)w;
    return frame;
  }
  return null;
}
 

Example 4

From project freemind, under directory /freemind/freemind/modes/mindmapmode/attributeactors/.

Source file: ListDialog.java

  22 
vote

public static void showDialog(Component frameComp,Component locationComp,String labelText,String title,SortedListModel possibleValues,String longValue){
  Frame frame=JOptionPane.getFrameForComponent(frameComp);
  dialog=new ListDialog(frame,locationComp,labelText,title,possibleValues,longValue);
  Tools.addEscapeActionToDialog(dialog);
  dialog.show();
}
 

Example 5

From project FScape, under directory /src/main/java/de/sciss/fscape/gui/.

Source file: MenuFactory.java

  22 
vote

private File queryFile(){
  FileDialog fDlg;
  String strFile, strDir;
  final Component ownerF=((AbstractWindow)getApplication().getComponent(Main.COMP_MAIN)).getWindow();
  final boolean makeF=!(ownerF instanceof Frame);
  final Frame f=makeF ? new Frame() : (Frame)ownerF;
  fDlg=new FileDialog(f,getResourceString("fileDlgOpen"),FileDialog.LOAD);
  fDlg.setVisible(true);
  if (makeF)   f.dispose();
  strDir=fDlg.getDirectory();
  strFile=fDlg.getFile();
  if (strFile == null)   return null;
  return (new File(strDir,strFile));
}
 

Example 6

From project jchempaint, under directory /src/main/org/openscience/jchempaint/action/.

Source file: AboutAction.java

  22 
vote

public void actionPerformed(ActionEvent e){
  Frame frame=JOptionPane.getFrameForComponent(jcpPanel);
  AboutDialog ad=new AboutDialog(frame,jcpPanel.getGuistring());
  ad.pack();
  ad.setVisible(true);
}
 

Example 7

From project jftp, under directory /src/main/java/com/myjavaworld/jftp/ssl/.

Source file: SecurityWarningDlg.java

  22 
vote

public static int showDialog(Component invoker,Certificate[] chain,boolean validDate,boolean validHost,boolean trusted){
  Frame parent=null;
  if (invoker instanceof Frame) {
    parent=(Frame)invoker;
  }
 else {
    parent=(Frame)SwingUtilities.getAncestorOfClass(Frame.class,invoker);
  }
  SecurityWarningDlg dlg=new SecurityWarningDlg(parent,chain,validDate,validHost,trusted);
  dlg.setLocationRelativeTo(parent);
  dlg.setVisible(true);
  return dlg.option;
}
 

Example 8

From project OpenSettlers, under directory /src/java/soc/client/.

Source file: AWTClickTester.java

  22 
vote

/** 
 * @param args
 */
public static void main(String[] args){
  Frame f=new Frame("Click tester");
  AWTClickTester ct=new AWTClickTester();
  f.add(ct);
  f.pack();
  f.setVisible(true);
  ct.printButtonsMods();
}
 

Example 9

From project PhonePledge, under directory /src/phonepledge/client/gui/.

Source file: LoginDialog.java

  22 
vote

public static String[] showDialog(Component frameComp){
  Frame frame=JOptionPane.getFrameForComponent(frameComp);
  dialog=new LoginDialog(frame);
  dialog.setLocationRelativeTo(frameComp);
  dialog.setResizable(false);
  dialog.setVisible(true);
  return dialog.getCredentials();
}
 

Example 10

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

Source file: SplashWindow.java

  21 
vote

/** 
 * Open's a splash window using the specified image.
 * @param image The splash image.
 */
public static void splash(Image image){
  if (instance == null && image != null) {
    Frame f=new Frame();
    instance=new SplashWindow(f,image);
    instance.setVisible(true);
    if (!EventQueue.isDispatchThread() && Runtime.getRuntime().availableProcessors() == 1) {
synchronized (instance) {
        while (!instance.paintCalled) {
          try {
            instance.wait();
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
  }
}
 

Example 11

From project jumpnevolve, under directory /lib/slick/src/org/newdawn/slick/tests/.

Source file: CanvasContainerTest.java

  21 
vote

/** 
 * Entry point to our test
 * @param argv The arguments to pass into the test
 */
public static void main(String[] argv){
  try {
    CanvasGameContainer container=new CanvasGameContainer(new CanvasContainerTest());
    Frame frame=new Frame("Test");
    frame.setLayout(new GridLayout(1,2));
    frame.setSize(500,500);
    frame.add(container);
    frame.addWindowListener(new WindowAdapter(){
      public void windowClosing(      WindowEvent e){
        System.exit(0);
      }
    }
);
    frame.setVisible(true);
    container.start();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 12

From project KindleTERM, under directory /src/j2me/kindle/.

Source file: RemoteKeyboard.java

  21 
vote

public static void main(String[] args){
  FileInputStream fis=null;
  try {
    final Frame frame=new Frame("Type here");
    frame.setPreferredSize(new Dimension(800,600));
    frame.setSize(new Dimension(800,600));
    fis=new FileInputStream("remote_keyboard.properties");
    Properties props=new Properties();
    props.load(fis);
    String host=props.getProperty("host");
    int port=Integer.parseInt(props.getProperty("port"));
    frame.addWindowListener(new WindowAdapter(){
      public void windowClosing(      WindowEvent e){
        frame.dispose();
        System.exit(0);
      }
    }
);
    RemoteKeyboard rk=new RemoteKeyboard(host,port);
    frame.addKeyListener(rk);
    frame.setFocusTraversalKeysEnabled(false);
    frame.setVisible(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      fis.close();
    }
 catch (    IOException ex) {
      ex.printStackTrace();
    }
  }
}
 

Example 13

From project netifera, under directory /platform/com.netifera.platform.ui.visualizations/com.netifera.platform.ui.graphs/src/com/netifera/platform/ui/graphs/utils/.

Source file: AWTEmbeddedControl.java

  21 
vote

public AWTEmbeddedControl(Composite parent){
  super(parent,SWT.NO_BACKGROUND | SWT.BORDER | SWT.EMBEDDED);
  Frame locationFrame=SWT_AWT.new_Frame(this);
  Panel panel=new Panel(new BorderLayout()){
    private static final long serialVersionUID=3447368094074143729L;
    public void update(    java.awt.Graphics g){
      paint(g);
    }
  }
;
  locationFrame.add(panel);
  JRootPane root=new JRootPane();
  panel.add(root);
  Container contentPane=root.getContentPane();
  RGB backgroundColor=getBackground().getRGB();
  locationFrame.setBackground(new java.awt.Color(backgroundColor.red,backgroundColor.green,backgroundColor.blue));
  locationFrame.setIgnoreRepaint(false);
  locationFrame.setVisible(true);
  embeddee=createAWTComponent();
  contentPane.add(embeddee);
}
 

Example 14

From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/core/.

Source file: AwtEnvironment.java

  21 
vote

/** 
 * Creates an AWT frame suitable as a parent for AWT/Swing dialogs.  <p> This method must be called from the SWT event thread. There must be an active shell associated with the environment's display. <p> The created frame is a non-visible child of the given shell and will be disposed when that shell is disposed. <p> This method is useful for creating a frame to parent any AWT/Swing dialogs created for use inside a SWT application. A modal AWT/Swing dialogs will behave better if its parent is set to the returned frame rather than to null or to an independently created  {@link java.awt.Frame}. <p> The frame is positioned such that its child AWT dialogs are centered over the given parent shell's position <i>when this method is called</i>. If the parent frame is  later moved, the child will no longer be properly positioned. For best results, create a new frame with this method immediately before creating and displaying each child AWT/Swing dialog.  <p> As with any AWT window, the returned frame must be explicitly disposed.
 * @param parent - the SWT parent shell of the shell that will contain the returned frame  
 * @return a {@link java.awt.Frame} to be used for parenting dialogs
 * @exception SWTException <ul> <li>ERROR_THREAD_INVALID_ACCESS - if not called from the SWT event thread </ul>
 * @exception IllegalStateException if the current display has no shells
 */
public Frame createDialogParentFrame(final Shell parent){
  if (parent == null) {
    SWT.error(SWT.ERROR_NULL_ARGUMENT);
  }
  if (!this.display.equals(Display.getCurrent())) {
    SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
  }
  final Shell shell=new Shell(parent,SWT.NO_TRIM | SWT.APPLICATION_MODAL);
  final Composite composite=new Composite(shell,SWT.EMBEDDED);
  final Frame frame=SWT_AWT.new_Frame(composite);
  shell.setLocation(parent.getLocation());
  if (Platform.isGtk()) {
    shell.setSize(0,0);
    shell.setVisible(true);
    shell.setVisible(false);
  }
  shell.setSize(parent.getSize());
  shell.setLayout(new FillLayout());
  shell.layout();
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosed(    final WindowEvent e){
      if (!AwtEnvironment.this.display.isDisposed()) {
        ThreadingHandler.getInstance().asyncExec(AwtEnvironment.this.display,new Runnable(){
          public void run(){
            shell.dispose();
          }
        }
);
      }
    }
  }
);
  return frame;
}
 

Example 15

From project PixelController, under directory /src/main/java/com/neophob/sematrix/generator/.

Source file: ScreenCapture.java

  21 
vote

/** 
 * Instantiates a new ScreenCapture Generator.
 * @param controller the controller
 */
public ScreenCapture(PixelControllerGenerator controller,final int offset,int width,int height){
  super(controller,GeneratorName.SCREEN_CAPTURE,ResizeName.QUALITY_RESIZE);
  if (width < 1) {
    width=internalBufferXSize * 2;
  }
  if (height < 1) {
    height=internalBufferYSize * 2;
  }
  rectangleCaptureArea=new Rectangle(offset,offset,width,height);
  try {
    robot=new Robot();
    LOG.log(Level.INFO,"ScreenCapture initialized, offset " + rectangleCaptureArea.x + "/"+ rectangleCaptureArea.y+ ", size: "+ rectangleCaptureArea.width+ "/"+ rectangleCaptureArea.height);
    Frame frame=new Frame();
    frame.setName("PixelController ScreenCapture Area");
    left=drawReadBorder(frame,BORDER_SIZE,height,offset - BORDER_SIZE,offset);
    right=drawReadBorder(frame,BORDER_SIZE,height,offset + width,offset);
    top=drawReadBorder(frame,width + BORDER_SIZE * 2,BORDER_SIZE,offset - BORDER_SIZE,offset - BORDER_SIZE);
    bottom=drawReadBorder(frame,width + BORDER_SIZE * 2,BORDER_SIZE,offset - BORDER_SIZE,height + offset);
  }
 catch (  Exception e) {
    LOG.log(Level.SEVERE,"Failed to initialize ScreenCapture: {0}",e);
  }
}
 

Example 16

From project grid-goggles, under directory /Dependent Libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  20 
vote

private void launch(){
  GraphicsDevice displayDevice=null;
  if (displayDevice == null) {
    GraphicsEnvironment environment=GraphicsEnvironment.getLocalGraphicsEnvironment();
    displayDevice=environment.getDefaultScreenDevice();
  }
  frame=new Frame(displayDevice.getDefaultConfiguration());
  frame.setResizable(false);
  init();
  frame.pack();
  frame.setLocation(x,y);
  Insets insets=frame.getInsets();
  int windowW=Math.max(width,MIN_WINDOW_WIDTH) + insets.left + insets.right;
  int windowH=Math.max(height,MIN_WINDOW_HEIGHT) + insets.top + insets.bottom;
  frame.setSize(windowW,windowH);
  frame.setLayout(null);
  frame.add(this);
  frame.setBackground(Color.black);
  int usableWindowH=windowH - insets.top - insets.bottom;
  setBounds((windowW - width) / 2,insets.top + (usableWindowH - height) / 2,width,height);
  frame.addWindowListener(this);
  frame.addComponentListener(this);
  frame.setName(_myName);
  frame.setTitle(_myName + " x:" + x+ " y:"+ y+ "   w:"+ width+ " h:"+ height);
  frame.setVisible(true);
  requestFocus();
}
 

Example 17

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

Source file: FloatingModalWindow.java

  20 
vote

public FloatingModalWindow(String title,int sizeW,int sizeH,int posiX,int posiY,boolean visi){
  super(new Frame(),title);
  sizW=sizeW;
  sizH=sizeH;
  posX=posiX;
  posY=posiY;
  visible=visi;
  cp=getContentPane();
  cp.setLayout(new BorderLayout());
  cp.setFocusable(false);
  pan=new JPanel();
  pan.setVisible(true);
  pan.setFocusable(false);
  cp.add(pan,BorderLayout.CENTER);
  setModal(true);
  setResizable(false);
  setSize(sizW,sizH);
  setLocation(posX,posY);
  setFocusable(true);
}
 

Example 18

From project jupload, under directory /src/wjhk/jupload2/gui/.

Source file: JUploadPanel.java

  20 
vote

/** 
 * Reaction to a click on the browse button.
 */
public void doBrowse(){
  String cmd;
  if (null != (cmd=this.uploadPolicy.getCallBackString(UploadPolicy.PROP_CALLBACK_FILE_DIALOG_START))) {
    try {
      this.uploadPolicy.performCallback(cmd,null,true);
    }
 catch (    Exception ex) {
      this.uploadPolicy.displayErr(ex);
    }
  }
  if (null != this.fileChooser) {
    try {
      if (JUploadPanel.currentDir != null)       this.fileChooser.setCurrentDirectory(this.currentDir);
      int ret=this.fileChooser.showOpenDialog(new Frame());
      if (JFileChooser.APPROVE_OPTION == ret) {
        String end_cmd;
        Integer n_selected=this.fileChooser.getSelectedFiles().length;
        JUploadPanel.currentDir=this.fileChooser.getCurrentDirectory();
        addFiles(this.fileChooser.getSelectedFiles(),this.fileChooser.getCurrentDirectory());
        if (null != (end_cmd=this.uploadPolicy.getCallBackString(UploadPolicy.PROP_CALLBACK_FILE_DIALOG_COMPLETE))) {
          try {
            String[] args={n_selected.toString(),n_selected.toString()};
            this.uploadPolicy.performCallback(end_cmd,args,true);
          }
 catch (          Exception ex) {
            this.uploadPolicy.displayErr(ex);
          }
        }
      }
      this.fileChooser.shutdownNow();
    }
 catch (    Exception ex) {
      this.uploadPolicy.displayErr(ex);
    }
  }
}
 

Example 19

From project Laserschein, under directory /src/laserschein/ui/.

Source file: ControlWindow.java

  20 
vote

private ControlWindow(final Laserschein theSchein,int theWidth,int theHeight){
  _myWidth=theWidth;
  _myHeight=theHeight;
  _myFrame=new Frame("Simulacrum");
  _myFrame.setFont(new Font(Font.DIALOG,Font.PLAIN,5));
  _myFrame.setResizable(false);
  _myFrame.setLayout(new BorderLayout());
  _myFrame.setFocusTraversalKeysEnabled(true);
  _myFrame.setFocusable(true);
  _mySchein=theSchein;
  final JTabbedPane myPane=new JTabbedPane();
  myPane.setPreferredSize(new Dimension(250,0));
  myPane.addTab("Output",initSimulationPanel());
  myPane.addTab("Optimizer",initOptimizerPanel());
  myPane.addTab("Geometry",initGeometryPanel());
  _myFrame.add(myPane,BorderLayout.WEST);
  this.setPreferredSize(new Dimension(_myWidth,_myHeight));
  this.setSize(_myWidth,_myHeight);
  _myFrame.add(this);
  _myFrame.setSize(_myWidth + 250,_myHeight);
  _myFrame.setVisible(true);
  _myFrame.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent evt){
      unopen();
    }
  }
);
  _mySimulator=new Simulator();
  _myFrame.pack();
}
 

Example 20

From project leaves, under directory /libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  20 
vote

private void launch(){
  GraphicsDevice displayDevice=null;
  if (displayDevice == null) {
    GraphicsEnvironment environment=GraphicsEnvironment.getLocalGraphicsEnvironment();
    displayDevice=environment.getDefaultScreenDevice();
  }
  frame=new Frame(displayDevice.getDefaultConfiguration());
  frame.setResizable(false);
  init();
  frame.pack();
  frame.setLocation(x,y);
  Insets insets=frame.getInsets();
  int windowW=Math.max(width,MIN_WINDOW_WIDTH) + insets.left + insets.right;
  int windowH=Math.max(height,MIN_WINDOW_HEIGHT) + insets.top + insets.bottom;
  frame.setSize(windowW,windowH);
  frame.setLayout(null);
  frame.add(this);
  frame.setBackground(Color.black);
  int usableWindowH=windowH - insets.top - insets.bottom;
  setBounds((windowW - width) / 2,insets.top + (usableWindowH - height) / 2,width,height);
  frame.addWindowListener(this);
  frame.addComponentListener(this);
  frame.setName(_myName);
  frame.setTitle(_myName + " x:" + x+ " y:"+ y+ "   w:"+ width+ " h:"+ height);
  frame.setVisible(true);
  requestFocus();
}
 

Example 21

From project OWASP-WebScarab, under directory /src/no/geosoft/cc/ui/.

Source file: SplashScreen.java

  20 
vote

/** 
 * Create a new splash screen object of the specified image. The image file is located and referred to through the deployment, not the local file system; A typical value might be "/com/company/splash.jpg".
 * @param imageFileName  Name of image file resource to act as splash screen.
 */
public SplashScreen(String imageFileName){
  super(new Frame());
  try {
    Toolkit toolkit=Toolkit.getDefaultToolkit();
    URL imageUrl=getClass().getResource(imageFileName);
    image_=toolkit.getImage(imageUrl);
    MediaTracker mediaTracker=new MediaTracker(this);
    mediaTracker.addImage(image_,0);
    mediaTracker.waitForID(0);
    width_=image_.getWidth(this);
    height_=image_.getHeight(this);
    Dimension screenSize=toolkit.getScreenSize();
    x_=(screenSize.width - width_) / 2;
    y_=(screenSize.height - height_) / 2;
  }
 catch (  Exception exception) {
    exception.printStackTrace();
    image_=null;
  }
}
 

Example 22

From project project_bpm, under directory /Processing/libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  20 
vote

private void launch(){
  GraphicsDevice displayDevice=null;
  if (displayDevice == null) {
    GraphicsEnvironment environment=GraphicsEnvironment.getLocalGraphicsEnvironment();
    displayDevice=environment.getDefaultScreenDevice();
  }
  frame=new Frame(displayDevice.getDefaultConfiguration());
  frame.setResizable(false);
  init();
  frame.pack();
  frame.setLocation(x,y);
  Insets insets=frame.getInsets();
  int windowW=Math.max(width,MIN_WINDOW_WIDTH) + insets.left + insets.right;
  int windowH=Math.max(height,MIN_WINDOW_HEIGHT) + insets.top + insets.bottom;
  frame.setSize(windowW,windowH);
  frame.setLayout(null);
  frame.add(this);
  frame.setBackground(Color.black);
  int usableWindowH=windowH - insets.top - insets.bottom;
  setBounds((windowW - width) / 2,insets.top + (usableWindowH - height) / 2,width,height);
  frame.addWindowListener(this);
  frame.addComponentListener(this);
  frame.setName(_myName);
  frame.setTitle(_myName + " x:" + x+ " y:"+ y+ "   w:"+ width+ " h:"+ height);
  frame.setVisible(true);
  requestFocus();
}
 

Example 23

From project androvoip, under directory /src/com/mexuar/corraleta/ui/.

Source file: CantRecordDialog.java

  19 
vote

public CantRecordDialog(Frame frame,String title,boolean modal){
  super(frame,title,modal);
  try {
    jbInit();
    pack();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
 

Example 24

From project ANNIS, under directory /annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/.

Source file: InitDialog.java

  19 
vote

/** 
 * Creates new form InitDialog
 */
public InitDialog(java.awt.Frame parent,boolean modal,final CorpusAdministration corpusAdministration){
  super(parent,modal);
  this.parentFrame=parent;
  initComponents();
  getRootPane().setDefaultButton(btOk);
  this.corpusAdministration=corpusAdministration;
}
 

Example 25

From project beanmill_1, under directory /src/main/java/de/cismet/beanmill/.

Source file: ChooseHotkeyDialog.java

  19 
vote

/** 
 * Displays a modal dialog waiting for a new hotkey.
 * @param parent  DOCUMENT ME!
 * @return  the system dependant representation of the hotkey
 */
public static ChooseHotkeyDialog showHotkeyDialog(final Frame parent){
  if (LOG.isDebugEnabled()) {
    LOG.debug("showHKDialog with parent " + parent);
  }
  final ChooseHotkeyDialog dialog=new ChooseHotkeyDialog(parent);
  dialog.displayDialog();
  return dialog;
}
 

Example 26

From project Briss, under directory /src/main/java/at/laborg/briss/.

Source file: BrissGUI.java

  19 
vote

private void setStateAfterClusteringFinished(ClusterDefinition newClusters,PageExcludes newPageExcludes,File newSource){
  updateWorkingSet(newClusters,newPageExcludes,newSource);
  previewPanel.removeAll();
  mergedPanels=new ArrayList<MergedPanel>();
  for (  PageCluster cluster : workingSet.getClusterDefinition().getClusterList()) {
    MergedPanel p=new MergedPanel(cluster,this);
    previewPanel.add(p);
    mergedPanels.add(p);
  }
  progressBar.setString("Clustering and Rendering finished");
  cropButton.setEnabled(true);
  maximizeWidthButton.setEnabled(true);
  maximizeHeightButton.setEnabled(true);
  excludePagesButton.setEnabled(true);
  showPreviewButton.setEnabled(true);
  maximizeSizeButton.setEnabled(true);
  setSizeButton.setEnabled(true);
  setPositionButton.setEnabled(true);
  moveLeftButton.setEnabled(true);
  moveRightButton.setEnabled(true);
  moveUpButton.setEnabled(true);
  moveDownButton.setEnabled(true);
  selectAllButton.setEnabled(true);
  selectNoneButton.setEnabled(true);
  setIdleState("");
  pack();
  setExtendedState(Frame.MAXIMIZED_BOTH);
  previewPanel.repaint();
  repaint();
}
 

Example 27

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/progress/.

Source file: ProgressMonitorSwingWorker.java

  19 
vote

private static Window createBlockingWindow(){
  final Dialog window=new Dialog((Frame)null);
  window.setUndecorated(true);
  window.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
  window.setBounds(0,0,0,0);
  window.setFocusableWindowState(false);
  return window;
}
 

Example 28

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

Source file: GenericInputDialog.java

  19 
vote

/** 
 * Creates the reusable dialog.
 */
public GenericInputDialog(Frame aFrame,String title,String labelInput,DialogInputControl dialogInputControl){
  super(aFrame,true);
  this.dialogInputControl=dialogInputControl;
  setTitle(title);
  textField=new JTextField(30);
  Object[] array={labelInput,textField};
  Object[] options={btnString1,"Annuler"};
  optionPane=new JOptionPane(array,JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION,null,options,options[0]);
  setContentPane(optionPane);
  setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent we){
      optionPane.setValue(JOptionPane.CLOSED_OPTION);
    }
  }
);
  textField.addActionListener(this);
  optionPane.addPropertyChangeListener(this);
  pack();
}
 

Example 29

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

Source file: CServerDialog.java

  19 
vote

public CServerDialog(Frame parent){
  super(parent,"Create Server...");
  try {
    init();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 30

From project contribution_eevolution_smart_browser, under directory /base/src/org/eevolution/form/.

Source file: VBrowser.java

  19 
vote

/** 
 * Detail Protected Constructor.
 * @param frame parent
 * @param modal modal
 * @param WindowNo window no
 * @param value QueryValue
 * @param tableName table name
 * @param keyColumn key column (ignored)
 * @param multiSelection multiple selections
 * @param whereClause where clause
 */
public VBrowser(Frame frame,boolean modal,int WindowNo,String value,MBrowse browse,String keyColumn,boolean multiSelection,String whereClause){
  super(modal,WindowNo,value,browse,keyColumn,multiSelection,whereClause);
  m_frame.setTitle(m_Browse.getName());
  initComponents();
  statInit();
  p_loadedOK=initBrowser();
  m_frame.setPreferredSize(getPreferredSize());
  int no=detail.getRowCount();
  setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(),"SearchRows_EnterQuery"),false);
  setStatusDB(Integer.toString(no));
}
 

Example 31

From project daap, under directory /src/main/java/org/ardverk/daap/tools/.

Source file: PacketAnalyzer.java

  19 
vote

public static void main(String[] args){
  try {
    File file=null;
    if (args.length == 0) {
      FileDialog dialog=new FileDialog(new Frame(),"Select file...",FileDialog.LOAD);
      dialog.show();
      String d=dialog.getDirectory();
      String f=dialog.getFile();
      if (d != null && f != null) {
        args=new String[]{d + f};
      }
 else {
        System.out.println("No file selected... Bye!");
        System.exit(0);
      }
    }
    file=new File(args[0]);
    String result=process(file);
    System.out.println(result);
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
 finally {
    System.exit(0);
  }
}
 

Example 32

From project dawn-isencia, under directory /com.isencia.passerelle.engine/src/main/java/com/isencia/passerelle/actor/gui/.

Source file: PasserelleActorController.java

  19 
vote

/** 
 * Add an item to the given context menu that will open a dialog to add or remove ports from an object.
 * @param menu The context menu.
 * @param object The object whose ports are being manipulated.
 */
public JMenuItem create(final JContextMenu menu,NamedObj object){
  JMenuItem retv=null;
  final NamedObj target=object;
  if (target == null || !(target instanceof Entity) || (target instanceof Actor))   return null;
  Action configPortsAction=new AbstractAction(_configPorts){
    public void actionPerformed(    ActionEvent e){
      Component parent=menu.getInvoker();
      ModelGraphPanel passerelleGraphPanel=null;
      while (parent.getParent() != null) {
        if (parent instanceof ModelGraphPanel) {
          passerelleGraphPanel=(ModelGraphPanel)parent;
        }
        parent=parent.getParent();
      }
      if (passerelleGraphPanel != null) {
        DialogTableau dialogTableau=DialogTableau.createDialog((Frame)parent,_configuration,passerelleGraphPanel.getEffigy(),PortConfigurerDialog.class,(Entity)target);
        if (dialogTableau != null) {
          dialogTableau.show();
        }
      }
 else       if (parent instanceof TableauFrame) {
        DialogTableau dialogTableau=DialogTableau.createDialog((Frame)parent,_configuration,((TableauFrame)parent).getEffigy(),PortConfigurerDialog.class,(Entity)target);
        if (dialogTableau != null) {
          dialogTableau.show();
        }
      }
    }
  }
;
  retv=menu.add(configPortsAction,_configPorts);
  return retv;
}
 

Example 33

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

Source file: DialogBinary2External.java

  19 
vote

public DialogBinary2External(Frame owner){
  super(owner);
  List<String> list=new ArrayList<String>();
  list.add("CSV");
  list.add("Excel (*.xlsx)");
  this.setSize(640,200);
  this.setTitle("Convert Encog Binary Training to Other Format File");
  addProperty(this.binaryFile=new FileField("source file","Source Encog Binary File(*.egb)",true,false,EncogDocumentFrame.ENCOG_BINARY));
  addProperty(this.externalFile=new FileField("target file","Target File",true,true,null));
  addProperty(this.fileType=new ComboBoxField("type type","Export File Type",true,list));
  render();
}
 

Example 34

From project hudsontrayapp-plugin, under directory /client-common/src/main/java/org/hudson/trayapp/gui/.

Source file: MainFrame.java

  19 
vote

/** 
 * This method initializes this
 * @return void
 */
private void initialize(){
  this.setSize(580,797);
  this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/hudson/trayapp/gui/icons/16x16/hudson.png")));
  this.setContentPane(getJContentPane());
  this.setTitle("Hudson Tray Application");
  addWindowStateListener(new WindowStateListener(){
    public void windowStateChanged(    WindowEvent e){
      if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED && e.getNewState() == Frame.ICONIFIED) {
        setVisible(false);
        setState(Frame.NORMAL);
        dispose();
      }
    }
  }
);
}
 

Example 35

From project ib-ruby, under directory /misc/IBJts-965/java/TestJavaClient/.

Source file: ConnectDlg.java

  19 
vote

public ConnectDlg(Frame owner){
  super(owner,true);
  JPanel buttonPanel=new JPanel();
  buttonPanel.add(m_ok);
  buttonPanel.add(m_cancel);
  m_ok.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      onOk();
    }
  }
);
  m_cancel.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      onCancel();
    }
  }
);
  JPanel midPanel=new JPanel();
  midPanel.setLayout(new GridLayout(0,1,5,5));
  midPanel.add(new JLabel("IP Address (leave blank for local host)"));
  midPanel.add(m_ipAddress);
  midPanel.add(new JLabel("Port"));
  midPanel.add(m_port);
  midPanel.add(new JLabel("Client ID"));
  midPanel.add(m_clientId);
  m_clientId.setText(Integer.toString(LAST_CLIENT_ID));
  getContentPane().add(midPanel,BorderLayout.CENTER);
  getContentPane().add(buttonPanel,BorderLayout.SOUTH);
  setTitle("Connect");
  pack();
}
 

Example 36

From project jlac, under directory /src/org/sump/analyzer/.

Source file: DiagramLabels.java

  19 
vote

/** 
 * Internal method that initializes a dialog and add this component to it.
 * @param frame owner of the dialog
 */
private void initDialog(Frame frame){
  if (dialog != null && dialog.getOwner() != frame) {
    dialog.dispose();
    dialog=null;
  }
  if (dialog == null) {
    dialog=new JDialog(frame,"Diagram Labels",true);
    dialog.getContentPane().add(this);
    dialog.pack();
    dialog.setResizable(false);
  }
}
 

Example 37

From project jMemorize, under directory /src/jmemorize/core/.

Source file: Settings.java

  19 
vote

public static void loadFrameState(JFrame frame,String frameId){
  if (Settings.loadIsFrameMaximized(frameId)) {
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
  }
 else {
    Point framePosition=Settings.loadFramePosition(frameId);
    if (framePosition != null) {
      frame.setLocation(framePosition);
    }
 else {
      frame.setLocationRelativeTo(null);
    }
    Dimension frameSize=Settings.loadFrameSize(frameId);
    if (frameSize != null)     frame.setSize(frameSize);
  }
}
 

Example 38

From project JoshEdit, under directory /org/lateralgm/joshedit/.

Source file: CompletionMenu.java

  19 
vote

public CompletionMenu(Frame owner,JoshText a,int y,int x1,int x2,int caret,Completion[] c){
  area=a;
  row=y;
  wordStart=x1;
  wordEnd=x2;
  this.caret=caret;
  completions=c;
  keyHandler=new KeyHandler();
  completionList=new JList();
  completionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  completionList.addKeyListener(keyHandler);
  completionList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (apply())       e.consume();
 else       dispose();
    }
  }
);
  scroll=new JScrollPane(completionList);
  scroll.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  ph=new PopupHandler(owner,scroll);
  ph.addHideListener(new PopupHandler.HideListener(){
    @Override public void hidePerformed(    boolean wasVisible){
      dispose();
    }
  }
);
  reset();
}
 

Example 39

From project jreepad, under directory /src/jreepad/ui/.

Source file: PasswordDialog.java

  19 
vote

public PasswordDialog(String message,boolean confirm){
  super((Frame)null,"Enter password",true);
  pwdField1=new JPasswordField();
  Object[] array;
  if (confirm) {
    pwdField2=new JPasswordField();
    array=new Object[]{new JLabel(message),pwdField1,new JLabel("confirm:"),pwdField2};
  }
 else {
    array=new Object[]{new JLabel(message),pwdField1};
  }
  optionPane=new JOptionPane(array,JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
  optionPane.addPropertyChangeListener(this);
  setContentPane(optionPane);
  pack();
  setLocationRelativeTo(null);
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent we){
      optionPane.setValue(new Integer(JOptionPane.CLOSED_OPTION));
    }
  }
);
}
 

Example 40

From project jreversepro, under directory /src/main/java/org/jreversepro/gui/.

Source file: DlgFont.java

  19 
vote

public DlgFont(Frame owner,String title){
  super(owner,title,true);
  faces=new JComboBox(getFontObjects());
  faces.addItemListener(this);
  btnOk=new JButton("         Ok           ");
  btnCancel=new JButton("     Cancel        ");
  lblTest=new JLabel("AaBbCc123",SwingConstants.LEFT);
  lblTest.setFont(new Font("SansSerif",Font.PLAIN,OPTIMUM_SIZE));
  GridBagConstraints c=new GridBagConstraints();
  getContentPane().setLayout(new GridBagLayout());
  c.gridheight=2;
  c.weighty=1.0;
  c.weightx=3.0;
  getContentPane().add(faces,c);
  c.weighty=0.0;
  c.gridwidth=GridBagConstraints.REMAINDER;
  c.gridheight=1;
  c.weightx=0.0;
  getContentPane().add(btnOk,c);
  getContentPane().add(btnCancel,c);
  c.gridwidth=1;
  getContentPane().add(lblTest,c);
  setSize(500,120);
  setLocation(100,200);
  setResizable(false);
  btnOk.addActionListener(this);
  btnCancel.addActionListener(this);
}
 

Example 41

From project JSocksProxy, under directory /src/main/java/nu/najt/kecon/jsocksproxy/admin/.

Source file: JSocksProxyAdmin.java

  19 
vote

/** 
 * Constructor
 * @throws HeadlessException
 */
public JSocksProxyAdmin() throws HeadlessException {
  super();
  this.okButton.addActionListener(this);
  this.cancelButton.addActionListener(this);
  this.addListenButton.addActionListener(this);
  this.removeListenButton.addActionListener(this);
  this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  this.setState(Frame.NORMAL | Frame.MAXIMIZED_BOTH);
  this.updateComponents(this.getLocale());
  this.setResizable(false);
  this.pack();
  this.setLocationRelativeTo(null);
  this.addWindowStateListener(this);
}
 

Example 42

From project LateralGM, under directory /org/lateralgm/components/.

Source file: AboutBox.java

  19 
vote

public AboutBox(Frame owner){
  super(owner,Messages.getString("AboutBox.TITLE"),true);
  setResizable(false);
  JEditorPane ep=new JEditorPane("text/html",Messages.getString("AboutBox.ABOUT"));
  addSSRules(((HTMLDocument)ep.getDocument()).getStyleSheet());
  ep.setOpaque(false);
  ep.setEditable(false);
  setLinkHandler(ep);
  lockWidth(ep,Math.max(ep.getMinimumSize().width,400));
  JOptionPane op=new JOptionPane(ep,JOptionPane.PLAIN_MESSAGE,JOptionPane.DEFAULT_OPTION,null,Option.values());
  op.addPropertyChangeListener(JOptionPane.VALUE_PROPERTY,this);
  add(op);
  pack();
  setLocationRelativeTo(owner);
}
 

Example 43

From project mawLib, under directory /src/mxj/trunk/mawLib-mxj/src/net/christopherbaker/utils/filesystem/.

Source file: EasyFileDialog.java

  19 
vote

public static File loadFile(Frame f,String title,String defDir,String defFile,String[] fileExtensions,boolean allowDirectories){
  FileDialog fd=new FileDialog(f,title,FileDialog.LOAD);
  fd.setFile(defFile);
  fd.setFilenameFilter(new EasyFilenameFilter(fileExtensions,allowDirectories));
  fd.setDirectory(defFile);
  fd.setLocation(50,50);
  fd.setVisible(true);
  if (fd.getDirectory() != null && fd.getFile() != null) {
    return new File(fd.getDirectory(),fd.getFile());
  }
  return null;
}
 

Example 44

From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/ontology/.

Source file: OntologyWizard.java

  19 
vote

public OntologyWizard() throws SQLException, RemoteException {
  super((Frame)DialogUtils.getFrontWindow(),"Ontology Wizard",true);
  WizardStyle.setStyle(WizardStyle.MACOSX_STYLE);
  PageList model=new PageList();
  model.append(getNamePage());
  model.append(getSourcePage());
  model.append(getCreationPage());
  model.append(getCompletionPage());
  setPageList(model);
  setNextAction(new AbstractAction(){
    @Override public void actionPerformed(    ActionEvent e){
      String pageName=getCurrentPage().getTitle();
      if (pageName.equals(PAGENAME_NAME) && validateName()) {
        setCurrentPage(PAGENAME_SOURCE);
      }
 else       if (pageName.equals(PAGENAME_SOURCE)) {
        setCurrentPage(PAGENAME_CREATE);
      }
 else       if (pageName.equals(PAGENAME_CREATE)) {
        setCurrentPage(PAGENAME_COMPLETE);
      }
    }
  }
);
  pack();
  setResizable(false);
  setLocationRelativeTo(DialogUtils.getFrontWindow());
}
 

Example 45

From project Moneychanger, under directory /src/main/java/com/moneychanger/ui/dialogs/.

Source file: AccountAdditionDialog.java

  19 
vote

/** 
 * Creates new form AccountAdditionDialog 
 */
public AccountAdditionDialog(java.awt.Frame parent,boolean modal,String nymID,String assetID,String serverID,String type,String selectedID){
  super(parent,modal);
  this.parent=parent;
  this.serverID=serverID;
  this.nymID=nymID;
  this.assetID=assetID;
  this.selectedID=selectedID;
  setTitle("Account Addition");
  initComponents();
  initValues(type);
  this.setLocationRelativeTo(null);
}
 

Example 46

From project movsim, under directory /viewer/src/main/java/org/movsim/viewer/ui/.

Source file: AppFrame.java

  19 
vote

private void initFrameSize(Properties properties){
  int xPixSize=Integer.parseInt(properties.getProperty("xPixSizeWindow"));
  int yPixSize=Integer.parseInt(properties.getProperty("yPixSizeWindow"));
  if (xPixSize < 0 || yPixSize < 0) {
    setExtendedState(Frame.MAXIMIZED_BOTH);
  }
 else {
    setSize(xPixSize,yPixSize);
  }
}
 

Example 47

From project OMS3, under directory /src/main/java/ngmf/util/cosu/.

Source file: MH.java

  19 
vote

public boolean action(Event e,Object o){
  int oldcursor=getCursorType();
  setCursor(Frame.WAIT_CURSOR);
  if (e.target == burnin) {
    if (mh == null) {
      mh=setup.newMH();
    }
    int iterations=Integer.parseInt(iterIn.getText());
    for (int d=0; d < dimension; d++) {
      graphs[d].draw(null,0,0);
    }
    for (int i=0; i < iterations; i++) {
      mh.next();
    }
    ageOut.setText("" + mh.getAge());
  }
 else   if (e.target == further) {
    if (mh == null) {
      mh=setup.newMH();
    }
    simulateAndDraw();
  }
  setCursor(oldcursor);
  return true;
}
 

Example 48

From project Openbravo-POS-iPhone-App, under directory /UnicentaPOS/src-beans/com/openbravo/beans/.

Source file: JNumberDialog.java

  19 
vote

public static Double showEditNumber(Component parent,String title,String message,Icon icon){
  Window window=SwingUtilities.windowForComponent(parent);
  JNumberDialog myMsg;
  if (window instanceof Frame) {
    myMsg=new JNumberDialog((Frame)window,true);
  }
 else {
    myMsg=new JNumberDialog((Dialog)window,true);
  }
  myMsg.setTitle(title,message,icon);
  myMsg.setVisible(true);
  return myMsg.m_value;
}
 

Example 49

From project packetsamurai, under directory /src/com/l2j/packetsamurai/gui/.

Source file: FilterDlg.java

  19 
vote

public FilterDlg(Frame owner,ViewPane vp){
  super(owner);
  this.setSize(275,450);
  this.setLocationRelativeTo(owner);
  this.setTitle("Filter");
  _viewPane=vp;
  this.init();
}
 

Example 50

From project pgslookandfeel, under directory /src/main/java/com/pagosoft/plaf/.

Source file: PgsLookAndFeel.java

  19 
vote

public static void updateAllUIs(){
  Frame[] frames=Frame.getFrames();
  for (int i=0; i < frames.length; i++) {
    if (frames[i] instanceof JFrame) {
      SwingUtilities.updateComponentTreeUI(frames[i]);
    }
  }
}
 

Example 51

From project pos_1, under directory /src-beans/com/openbravo/beans/.

Source file: JNumberDialog.java

  19 
vote

public static Double showEditNumber(Component parent,String title,String message,Icon icon){
  Window window=SwingUtilities.windowForComponent(parent);
  JNumberDialog myMsg;
  if (window instanceof Frame) {
    myMsg=new JNumberDialog((Frame)window,true);
  }
 else {
    myMsg=new JNumberDialog((Dialog)window,true);
  }
  myMsg.setTitle(title,message,icon);
  myMsg.setVisible(true);
  return myMsg.m_value;
}