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

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

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

JFrame.invalidate介绍

暂无

代码示例

代码示例来源:origin: net.sf.ingenias/editor

@Override
  public void actionPerformed(ActionEvent arg0) {
    jf.pack();
    jf.invalidate();
  }
});

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

public JFrame frame = new JFrame();
public JPanel pan = new JPanel();

public void replace() {
 frame.remove(pan);
 pan = new JPanel();
 GridLayout grid = new GridLayout(8,8);
 pan.setLayout(grid);
 pan.setVisible(true);
 frame.add(pan);
 frame.invalidate();
 frame.revalidate();
 frame.repaint();
 frame.pack();
 frame.setVisible(true);
}

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

@Override
  public void run() {
    rw.setJMenuBar(menuBar[0] = new JMenuBar()); 
    rw.invalidate();
    rw.validate();
  }});
} catch (InterruptedException e) {

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

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

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

@Override
  public void run() {
    if(item!=null){
    component.add(item);
    refreshOrdering(component);
    }
    rw.invalidate();
    rw.validate();
    //rw.revalidate();
  }});
}//end addMenuItemLater(...)

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

private void addCnctButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              
  JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this);

  AddConnectionPanel panel = new AddConnectionPanel();
  panel.setConnectionPanelListener(new ConnectionPanelListener(){

    @Override
    void onOkButtonClicked(String... options){ TODO: fill sPanel using the given Strings }

    @Override
    void onCancelButtonClicked(){ TODO }
  });

  topFrame.setContentPane(panel);
  topFrame.invalidate();
  topFrame.validate();
}

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

@Override
  public void run() {
    if(it!=null)
    parent.remove(it);
    rw.invalidate();
    rw.validate();
    //rw.revalidate();
  }});
}//end if(!null)

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

@Override
  public void run() {
    parent.remove(item);
    rw.invalidate();
    rw.validate();
  }});
}//end invokeLater

代码示例来源:origin: Multibit-Legacy/multibit-hd

public void run() {
  // Switch the theme before any other UI building takes place
  handleTheme();
  // Rebuild MainView contents
  handleLocale();
  // Force a frame redraw
  Panels.getApplicationFrame().invalidate();
  // Rebuild the detail views and alert panels
  if (mainView != null) {
   mainView.refresh(true);
  }
 }
});

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

jpAnnotation.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e)
  {
    JFrame myInternalFrame= (JFrame)SwingUtilities.getWindowAncestor(this);
    myInternalFrame.remove(PDFJPanel.this);
    myInternalFrame.invalidate();
    myInternalFrame.validate();
    myInternalFrame.repaint();
  }
});

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

protected void refreshOrdering(final JComponent component){
  final TreeSet<JMenuItem> items = new TreeSet<JMenuItem>(new JMenuItemComparator());
  if(component instanceof JMenu){
  for(java.awt.Component comp : ((JMenu)component).getMenuComponents())
    if(comp instanceof JMenuItem)
    items.add((JMenuItem)comp);
  }else if(component instanceof JMenuBar)
  for(MenuElement elm : ((JMenuBar)component).getSubElements())
    if(elm instanceof JMenuItem)
    items.add((JMenuItem)elm);
  for(JMenuItem jMenuItem : items)
  component.remove(jMenuItem);
  for(JMenuItem jMenuItem : items)
  component.add(jMenuItem);
  rw.invalidate();
  rw.validate();
}//end refreshOrderingLater(...)

代码示例来源:origin: igniterealtime/Spark

mainPanel.validate();
mainPanel.repaint();
frame.invalidate();
frame.validate();
frame.repaint();

代码示例来源:origin: org.jspresso.framework/jspresso-swing-application

private void updateControllerFrame() {
 // controllerFrame.setJMenuBar(createApplicationMenuBar());
 controllerFrame.getContentPane().add(createApplicationToolBar(),
   BorderLayout.NORTH);
 if (getSecondaryActionMap() != null
   && isAccessGranted(getSecondaryActionMap())) {
  try {
   pushToSecurityContext(getSecondaryActionMap());
   controllerFrame.getContentPane().add(
     createSecondaryApplicationToolBar(), BorderLayout.SOUTH);
  } finally {
   restoreLastSecurityContextSnapshot();
  }
 }
 controllerFrame.invalidate();
 controllerFrame.validate();
 updateFrameTitle();
}

代码示例来源:origin: igniterealtime/Spark

mainPanel.validate();
mainPanel.repaint();
frame.invalidate();
frame.validate();
frame.repaint();

代码示例来源:origin: org.icepdf.os/icepdf-viewer

if (viewer != null) {
  viewer.setTitle(messageBundle.getString("viewer.window.title.default"));
  viewer.invalidate();
  viewer.validate();
  viewer.getContentPane().repaint();

代码示例来源:origin: Multibit-Legacy/multibit-hd

public void run() {
  // Switch the theme before any other UI building takes place
  handleTheme();
  // Rebuild MainView contents
  handleLocale();
  // Force a frame redraw
  Panels.getApplicationFrame().invalidate();
  // Rebuild the detail views and alert panels
  mainView.refresh(false);
  // Show the current detail screen
  Screen screen = Screen.valueOf(Configurations.currentConfiguration.getAppearance().getCurrentScreen());
  ViewEvents.fireShowDetailScreenEvent(screen);
  // Trigger the alert panels to refresh
  headerController.refresh();
 }
});

代码示例来源:origin: triplea-game/triplea

battleFrame.setVisible(true);
 battleFrame.validate();
 battleFrame.invalidate();
 battleFrame.repaint();
} else {

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

Action createCOToggle(final JFrame frame) {
  Action toggleComponentOrientation = new AbstractAction("toggle orientation") {

    @Override
    public void actionPerformed(ActionEvent e) {
      ComponentOrientation current = frame.getComponentOrientation();
      if (current.isLeftToRight()) {
        frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
      } else {
        frame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
      }
      frame.getRootPane().revalidate();
      frame.invalidate();
      frame.validate();
      frame.repaint();
    }

  };
  return toggleComponentOrientation;
}

代码示例来源:origin: uk.co.caprica/vlcj

@Override
  public void eventDispatched(AWTEvent event) {
    if (event instanceof KeyEvent) {
      KeyEvent keyEvent = (KeyEvent)event;
      if (keyEvent.getID() == KeyEvent.KEY_PRESSED) {
        if (keyEvent.getKeyCode() == KeyEvent.VK_F12) {
          controlsPanel.setVisible(!controlsPanel.isVisible());
          videoAdjustPanel.setVisible(!videoAdjustPanel.isVisible());
          mainFrame.getJMenuBar().setVisible(!mainFrame.getJMenuBar().isVisible());
          mainFrame.invalidate();
          mainFrame.validate();
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_A) {
          mediaPlayer.audio().setDelay(mediaPlayer.audio().delay() - 50000);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_S) {
          mediaPlayer.audio().setDelay(mediaPlayer.audio().delay() + 50000);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_1) {
          mediaPlayer.controls().setTime(60000 * 1);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_2) {
          mediaPlayer.controls().setTime(60000 * 2);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_3) {
          mediaPlayer.controls().setTime(60000 * 3);
        }
      }
    }
  }
}, AWTEvent.KEY_EVENT_MASK);

相关文章

JFrame类方法