javax.swing.JFrame.validate()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(315)

本文整理了Java中javax.swing.JFrame.validate()方法的一些代码示例,展示了JFrame.validate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.validate()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:validate

JFrame.validate介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public final class ScreenSaver {

   public static final void main(final String[] args) throws Exception {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

     final JFrame screenSaverFrame = new JFrame();
     screenSaverFrame.setDefaultCloseOperation(
       WindowConstants.EXIT_ON_CLOSE);
     screenSaverFrame.setUndecorated(true);
     screenSaverFrame.setResizable(false);
     screenSaverFrame.add(new JLabel("This is a Java Screensaver!",
               SwingConstants.CENTER), BorderLayout.CENTER);
     screenSaverFrame.validate();
     GraphicsEnvironment.getLocalGraphicsEnvironment()
          .getDefaultScreenDevice()
          .setFullScreenWindow(screenSaverFrame);
  }
}

代码示例来源:origin: nodebox/nodebox

public void mousePressed(MouseEvent e) {
    isDragging = false;
    JComponent c = ColorWell.this;
    JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c);
    if (frame == null) return;
    Point pt = c.getLocation();
    pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane());
    Rectangle r = c.getBounds();
    frame.setGlassPane(colorPicker);
    colorPicker.setVisible(true);
    colorPicker.setPoint(new Point(pt.x, pt.y + r.height));
    frame.validate();
  }
}

代码示例来源:origin: nodebox/nodebox

public void mousePressed(MouseEvent e) {
    isDragging = false;
    JComponent c = ColorWell.this;
    JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c);
    if (frame == null) return;
    Point pt = c.getLocation();
    pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane());
    Rectangle r = c.getBounds();
    frame.setGlassPane(colorPicker);
    colorPicker.setVisible(true);
    colorPicker.setPoint(new Point(pt.x, pt.y + r.height));
    frame.validate();
  }
}

代码示例来源:origin: com.metsci.glimpse/glimpse-core-examples

@Override
  public void run( )
  {
    rightFrame.add( rightPanel );
    leftFrame.add( leftPanel );
    rightFrame.validate( );
    leftFrame.validate( );
  }
} );

代码示例来源:origin: us.ihmc/IHMCJavaToolkit

private void disposeSearchResults()
  {
   resultsPanel.setVisible(false);
   frame.pack();
   frame.validate();
  }
}

代码示例来源:origin: us.ihmc/ihmc-java-toolkit

private void disposeSearchResults()
  {
   resultsPanel.setVisible(false);
   frame.pack();
   frame.validate();
  }
}

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame(); // <<< Just so no-one gets lost here
frame.getContentPane().removeAll();
frame.getContentPane().add( newScreen );
frame.validate();
frame.repaint();

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

public void run() {
    Demo app = new Demo();
    JFrame f = new JFrame("Concurrency test");
    f.getContentPane().setLayout(new BorderLayout());
    f.getContentPane().add(app, BorderLayout.CENTER);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setSize(400, 400);
    f.setVisible(true);
    f.validate();
    app.startWorking();
  }
});

代码示例来源:origin: MegaMek/megamek

/**
 * Lays out the frame by setting this Client object to take up the full
 * frame display area.
 */
private void layoutFrame() {
  frame.setTitle(client.getName() + Messages.getString("ClientGUI.clientTitleSuffix")); //$NON-NLS-1$
  frame.getContentPane().setLayout(new BorderLayout());
  frame.getContentPane().add(this, BorderLayout.CENTER);
  frame.validate();
}

代码示例来源:origin: MegaMek/megamek

/**
 * Lays out the frame by setting this Client object to take up the full
 * frame display area.
 */
private void layoutFrame() {
  frame.setTitle(Messages.getString("MegaMek.SkinEditor.label") //$NON-NLS-1$ 
      + Messages.getString("ClientGUI.clientTitleSuffix")); //$NON-NLS-1$
  frame.getContentPane().setLayout(new BorderLayout());
  frame.getContentPane().add(this, BorderLayout.CENTER);
  frame.validate();
}

代码示例来源:origin: jpos/jPOS

public void showLogList() {
  JFrame f = new JFrame(parent.getSymbolicName());
  f.getContentPane().add(createLogList());
  f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  f.validate();
  f.pack();
  f.setSize(width,width+50);
  f.show();
}

代码示例来源:origin: net.sf.sf3jswing/kernel-core

private void _initSplashFrame(GraphicsConfiguration gc) {
    splashFrame = new JFrame(gc);
    splashFrame.setUndecorated(true);
    splashFrame.setContentPane(splashContents);
    UIMessage._makeUncloseable(splashFrame);
    splashFrame.validate();
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  JFrame frame = new JFrame("test");
  frame.setSize(900, 600);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new CardLayout());
  frame.setVisible(true);
  LateralSupportPane p = new LateralSupportPane();
  frame.add(p);
  frame.validate();
  p.addLabel("test 2");
  p.validate();
}

代码示例来源:origin: com.b3dgs.lionengine/lionengine-core-awt

@Override
public void start()
{
  super.start();
  frame.validate();
  frame.setEnabled(true);
  frame.setVisible(true);
}

代码示例来源:origin: edu.illinois.cs.cogcomp/DatalessClassification

public void actionPerformed(ActionEvent e) {     
      window.remove(panel2);
      window.setContentPane(myPanel);
      window.validate();
      window.repaint();
  }
});

代码示例来源:origin: jtrfp/terminal-recall

public void run(){
    if(itemToAdd!=null){
    parent.add(itemToAdd);
    refreshOrdering(parent);
    }
    rw.invalidate();
    rw.validate();
  }});
}//end addSubMenuLater(...)

代码示例来源:origin: edu.illinois.cs.cogcomp/DatalessClassification

@Override
  public void actionPerformed(ActionEvent actionEvent) {
    window.remove(panel1);
    window.setContentPane(myPanel);
    window.validate();
    window.repaint();
    
  }
};

代码示例来源:origin: org.fudaa.framework.fudaa/fudaa-common

void rafraichir(){
 pdfViewer.revalidate();
 this.revalidate();
 frame_.validate();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-vmd-game

public static void center(JFrame frame) {
  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  Point center = ge.getCenterPoint();
  Rectangle bounds = ge.getMaximumWindowBounds();
  int w = Math.min(frame.getWidth(), bounds.width);
  int h = Math.min(frame.getHeight(), bounds.height);
  int x = center.x - w/2, y = center.y - h/2;
  frame.setBounds(x, y, w, h);
  if (w == bounds.width && h == bounds.height)
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
  frame.validate();
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
 public void mouseClicked(MouseEvent e) {
  frame.getLayeredPane().remove(imagePanel);
  frame.getLayeredPane().remove(backgroundPanel);
  frame.validate();
  frame.repaint();
 }
});

相关文章

JFrame类方法