congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Container.validate
Code IndexAdd Tabnine to your IDE (free)

How to use
validate
method
in
java.awt.Container

Best Java code snippets using java.awt.Container.validate (Showing top 20 results out of 819)

Refine searchRefine arrow

  • Window.setVisible
  • Container.add
  • JFrame.setDefaultCloseOperation
  • JPanel.<init>
origin: stanfordnlp/CoreNLP

private static void useProgressBarHelper(Container parent, JComponent add, JComponent remove) {
 GridBagConstraints c = new GridBagConstraints();
 c.fill = GridBagConstraints.BOTH;
 c.weightx = 1.7;
 parent.remove(remove);
 parent.add(add,c);
 parent.validate();
 parent.repaint();
}
origin: stackoverflow.com

 import javax.swing.*;
import java.awt.*;

public class Main {
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    frame.setSize(600, 400);

    JPanel panel = new JPanel() {
      @Override
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.BLUE);
        g.fillRect(0, 0, 100, 100);
      }
    };
    frame.add(panel);

    // Graphics g = panel.getGraphics();
    // g.setColor(Color.BLUE);
    // g.fillRect(0, 0, 100, 100);

    frame.validate(); // because you added panel after setVisible was called
    frame.repaint(); // because you added panel after setVisible was called
  }
}
origin: stackoverflow.com

    JPanel p = new JPanel();
    mediaTypes.createGui(p, show);
    add(p);
    validate();
    MediaTypes mediaTypes = new MediaTypes();
    JPanel p = new JPanel();
    mediaTypes.createGui(p);
    JOptionPane.showMessageDialog(null,p);
panel.add(output, BorderLayout.SOUTH);
d = new Dimension(450,d.height);
tableScroll.setPreferredSize(d);
panel.add( tableScroll, BorderLayout.CENTER );
origin: stackoverflow.com

  frame.getContentPane().add(button);
  frame.pack();
  frame.setVisible(true);
progressBar.setStringPainted(true);
progressBar.setIndeterminate(true);
dialog.getContentPane().add(progressBar);
dialog.pack();
dialog.setModal( false );
JLabel label = new JLabel("Task Complete");
dialog.getContentPane().remove(progressBar);
dialog.getContentPane().add(label);
dialog.getContentPane().validate();
origin: stackoverflow.com

setDefaultCloseOperation(EXIT_ON_CLOSE);
setUndecorated(isFullScreen);
setResizable(!isFullScreen);
  validate();
} else {
  this.setVisible(true);
origin: stackoverflow.com

 import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class Test {

  public Test() {
    final JFrame frame = new JFrame("Screen Saver");
    frame.validate();
    frame.setVisible(true);

    KeyAdapter listener = new KeyAdapter() {
      @Override public void keyPressed(KeyEvent e) {
        frame.dispose();
      }
    };

    frame.addKeyListener(listener);
  }

  public static void main(String[] args) {
    new Test();
  }

}
origin: stackoverflow.com

public static void main(String[] args) {
  JFrame frame = new JFrame();
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  frame.setSize(600, 400);
  frame.add(panel);
  frame.validate(); // because you added panel after setVisible was called
origin: stackoverflow.com

private static final int           TOP               = 0x03;
private static final int           BOTTOM            = 0x04;
private final JPanel               basePanel         = new JPanel();
private final ParentType           parent;
private final Object               lock              = new Object();
  glassPane = new JPanel();
  glassPane.setOpaque(false);
  glassPane.addMouseListener(new MouseAdapter() {
  basePanel.setLayout(new BorderLayout());
  if (useSlideButton) {
    final JPanel statusPanel = new JPanel();
    basePanel.add(statusPanel, BorderLayout.SOUTH);
    statusPanel.add(new JButton("Slide Left") {
      private static final long serialVersionUID = 9204819004142223529L;
    statusPanel.add(new JButton("Slide Right") {
    ((JFrame) parent).getContentPane().setBackground(jPanels.get(0).getBackground());
    parent.remove(basePanel);
    parent.validate();
    parent.validate();
    parent.validate();
origin: nodebox/nodebox

  Dimension d = getSize();
  parent.remove(this);
  parent.add(newPane);
  newPane.setSize(d);
parent.validate();
SwingUtilities.invokeLater(new Runnable() {
  public void run() {
origin: stackoverflow.com

Component c = f.getComponents()[0];
f.remove(c);
f.setVisible(false);
add(c);
validate();
origin: stackoverflow.com

this.device = device;
setTitle("Display Mode Test");
setDefaultCloseOperation(EXIT_ON_CLOSE);
  validate();
} else {
  setVisible(true);
origin: org.netbeans.modules/org-netbeans-modules-xml-xam-ui

  void mouseRelease(MouseEvent e){
    if(alreadyDrawn){
      if(SplitterLayout.dragee!=this) return;
      SplitterLayout.dragee = null;
      Point p = wBar.getLocationOnScreen();
      SwingUtilities.convertPointFromScreen(p, getParent());
      wBar.setVisible(false);
      wBar.dispose();
      wBar = null;
      alreadyDrawn = false;
      Rectangle r = getBounds(); // mouse event is relative to this...
      r.x += e.getX();
//            //System.out.println("mouseReleased converted point "+ p);
//            //System.out.println("mouseRelease bounds of this spliltter " + r);
      setLocation(p.x, r.y);
      setCursor(DEF_CURSOR);
      
      // check to see if we need to move other splitters and hide other
      // components that are controlled by the layout
      // First -- find what component this one is
      
      checkOtherComponents();
      mouseInside = false;
      invalidate();
      getParent().validate();
      SplitterLayout.dragee = null;
    }
  }
  
origin: stackoverflow.com

super("Add component on JFrame at runtime");
setLayout(new BorderLayout());
this.panel = new JPanel();
this.panel.setLayout(new FlowLayout());
add(panel, BorderLayout.CENTER);
JButton button = new JButton("CLICK HERE");
add(button, BorderLayout.SOUTH);
button.addActionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
this.panel.add(new JButton("Button"));
this.panel.revalidate();
validate();
origin: antlr/antlrworks

private void createErrorPanel() {
  container.removeAll();
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(createErrorPane(), BorderLayout.NORTH);
  panel.add(createVisualizationPane(), BorderLayout.CENTER);
  container.add(panel, BorderLayout.CENTER);
  container.add(createControlPane(), BorderLayout.SOUTH);
  container.validate();
}
origin: jshiell/checkstyle-idea

private void moveToStep(final Step newStep) {
  remove(panelForCurrentStep());
  currentStep = newStep;
  if (currentStep.isAllowCommit()) {
    commitButton.setText(CheckStyleBundle.message("config.file.okay.text"));
    commitButton.setToolTipText(CheckStyleBundle.message("config.file.okay.text"));
  } else {
    commitButton.setText(CheckStyleBundle.message("config.file.next.text"));
    commitButton.setToolTipText(CheckStyleBundle.message("config.file.next.text"));
  }
  previousButton.setEnabled(currentStep.isAllowPrevious());
  commitButton.setEnabled(currentStep.isAllowNext() || currentStep.isAllowCommit());
  getContentPane().add(panelForCurrentStep(), BorderLayout.CENTER);
  getContentPane().validate();
  getContentPane().repaint();
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

  ((Window) floatingToolBar).setVisible(false);
  UIManager.removePropertyChangeListener(propertyListener);
dockingSource.add(toolBar, constraint.intValue());
dockingSource.invalidate();
Container dockingSourceParent = dockingSource.getParent();
if (dockingSourceParent != null) {
  dockingSourceParent.validate();
origin: stackoverflow.com

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel gui = new JPanel(new BorderLayout(5,5));
gui.setBorder( new TitledBorder("BorderLayout(5,5)") );
JPanel plafComponents = new JPanel(
  new FlowLayout(FlowLayout.RIGHT, 3,3));
plafComponents.setBorder(
plafComponents.add(plafChooser);
plafComponents.add(pack);
gui.add(plafComponents, BorderLayout.NORTH);
JPanel dynamicLabels = new JPanel(new BorderLayout(4,4));
dynamicLabels.setBorder(
  new TitledBorder("BorderLayout(4,4)") );
    labels.add( new JLabel("Label " + ++labelCount) );
    frame.validate();
frame.setVisible(true);
origin: stackoverflow.com

 //<applet code='Apletas' width='600' height='400'></applet>
import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.border.EmptyBorder;

public class Apletas extends JApplet {

  private JTextField inputLine;

  public Apletas()
  {
    inputLine = new JTextField(20);

    JPanel mainGui = new JPanel(new BorderLayout(20,20));
    mainGui.setBorder(new EmptyBorder(80,80,80,80));

    mainGui.add(inputLine, BorderLayout.NORTH);

    mainGui.add(new JScrollPane(new JTextArea(20,10)), BorderLayout.CENTER);
    JTree tree = new JTree();
    tree.expandRow(2);
    mainGui.add(new JScrollPane(tree), BorderLayout.WEST);

    setContentPane(mainGui);
    validate();
  }
}
origin: nodebox/nodebox

public void close() {
  Container parent = getParent();
  if (!(parent instanceof JSplitPane)) return;
  JSplitPane split = (JSplitPane) parent;
  Component firstComponent = split.getTopComponent();
  Component secondComponent = split.getBottomComponent();
  Component remainingComponent = firstComponent == this ? secondComponent : firstComponent;
  split.setTopComponent(null);
  split.setBottomComponent(null);
  Container grandParent = parent.getParent();
  if (grandParent instanceof JSplitPane) {
    JSplitPane grandSplit = (JSplitPane) grandParent;
    // Remove the split pane.
    if (split == grandSplit.getTopComponent()) {
      grandSplit.setTopComponent(remainingComponent);
    } else {
      grandSplit.setBottomComponent(remainingComponent);
    }
  } else {
    grandParent.remove(parent);
    grandParent.add(remainingComponent);
  }
  grandParent.validate();
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void windowClosing(WindowEvent w)
{
  if (toolBar.isFloatable() == true)
  {
    if (dragWindow != null)
      dragWindow.setVisible(false);
    floating= false;
    if (floatingToolBar == null)
      floatingToolBar= createFloatingWindow(toolBar);
    if (floatingToolBar instanceof Window)
       ((Window) floatingToolBar).setVisible(false);
    floatingToolBar.getContentPane().remove(toolBar);
    String constraint= constraintBeforeFloating;
    int orientation= mapConstraintToOrientation(constraint);
    setOrientation(orientation);
    if (dockingSource == null)
      dockingSource= toolBar.getParent();
    if (propertyListener != null)
      UIManager.removePropertyChangeListener(propertyListener);
    dockingSource.add(constraint, toolBar);
    dockingSource.invalidate();
    Container dockingSourceParent= dockingSource.getParent();
    if (dockingSourceParent != null)
      dockingSourceParent.validate();
    dockingSource.repaint();
    setFloating(false, null);
  }
}
java.awtContainervalidate

Javadoc

Validates this container and all of its subcomponents.

The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information changed) after the container has been displayed.

Popular methods of Container

  • add
    Adds the specified component to this container. This is a convenience method for #addImpl. This meth
  • setLayout
    Sets the layout manager for this container.
  • getComponents
    Gets all the components in this container.
  • getComponent
    Gets the nth component in this container.
  • getParent
  • getComponentCount
    Gets the number of components in this panel.
  • remove
    Removes the specified component from this container.
  • getWidth
  • getInsets
    Determines the insets of this container, which indicate the size of the container's border. A Frame
  • getSize
  • getHeight
  • repaint
  • getHeight,
  • repaint,
  • setBackground,
  • getLayout,
  • getTreeLock,
  • removeAll,
  • getPreferredSize,
  • getBackground,
  • getBounds

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • getContentResolver (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Permission (java.security)
    Legacy security code; do not use.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now