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

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

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

JDialog.validate介绍

暂无

代码示例

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

@Override
  public void actionPerformed (ActionEvent arg0) {
    if(editor.isUsingDefaultTexture()) {
      JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first.");
      return;
    }
    
    TextureAtlas atlas = editor.getAtlas();
    if(atlas != null)
      regionPickerPanel.setAtlas(atlas);
    else 
      regionPickerPanel.setTexture(editor.getTexture());
    
    regionPickerPanel.revalidate();
    regionPickerPanel.repaint();
    regionSelectDialog.validate();
    regionSelectDialog.repaint();
    regionSelectDialog.pack();
    regionSelectDialog.setVisible(true);
  }
});

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

@Override
  public void actionPerformed (ActionEvent arg0) {
    if(editor.isUsingDefaultTexture()) {
      JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first.");
      return;
    }
    
    TextureAtlas atlas = editor.getAtlas();
    if(atlas != null)
      regionPickerPanel.setAtlas(atlas);
    else 
      regionPickerPanel.setTexture(editor.getTexture());
    
    regionPickerPanel.revalidate();
    regionPickerPanel.repaint();
    regionSelectDialog.validate();
    regionSelectDialog.repaint();
    regionSelectDialog.pack();
    regionSelectDialog.setVisible(true);
  }
});

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

public void setDialogSize(int width, int height) {
  dialog.setSize(width, height);
  dialog.pack();
  dialog.validate();
}

代码示例来源:origin: bcdev/beam

/**
 * Sets the dialog's content component.
 *
 * @param content The dialog's content component.
 */
public void setContent(Component content) {
  if (this.content != null) {
    dialog.getContentPane().remove(this.content);
  }
  this.content = content;
  dialog.getContentPane().add(this.content, BorderLayout.CENTER);
  dialog.validate();
  updateHelpID();
}

代码示例来源:origin: senbox-org/snap-desktop

/**
 * Sets the dialog's content component.
 *
 * @param content The dialog's content component.
 */
public void setContent(Component content) {
  if (this.content != null) {
    dialog.getContentPane().remove(this.content);
  }
  this.content = content;
  dialog.getContentPane().add(this.content, BorderLayout.CENTER);
  dialog.validate();
  updateHelpID();
}

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

@Override
public void validate() {
  dollWrapper.setVisible(false);
  fillDoll(dollWrapper, campaign, person);
  dollWrapper.setVisible(true);
  injuryPanel.setVisible(false);
  fillInjuries(injuryPanel, campaign, person);
  injuryPanel.setVisible(true);
  super.validate();
}

代码示例来源:origin: net.clearvolume/cleargl

@Override
  public void run() {
    final JProgressBar lJProgressBar = new JProgressBar(0, 500);
    lJProgressBar.setValue(499);
    lJDialog.add(BorderLayout.CENTER, lJProgressBar);
    lJDialog.add(BorderLayout.NORTH,
        new JLabel("Saving images, please wait!"));
    lJDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    lJDialog.setSize(300, 75);
    lJDialog.validate();
    lJDialog.setVisible(true);
  }
});

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

JDialog dialog = new JDialog();
JLabel label = new JLabel("Test");
dialog.add(label);

// pack(), setSize(), validate() in this order will
// set sizes on all components as wished
dialog.pack();
dialog.setSize(800, 600);
dialog.validate();

System.out.println(label.getSize());

代码示例来源:origin: cytoscape.corelibs/task

/**
   * Toggle Show/Hide Error Details.
   *
   * @param e ActionEvent.
   */
  public void actionPerformed(ActionEvent e) {
    showDetails = !showDetails;
    detailsPane.setVisible(showDetails);
    owner.setResizable(showDetails);
    if (showDetails) {
      detailsButton.setText(HIDE_TEXT);
    } else {
      detailsButton.setText(SHOW_TEXT);
    }
    owner.pack();
    owner.validate();
  }
});

代码示例来源:origin: jaltekruse/OpenNotebook

public void createProbelmDialog() {
  if (problemDialog != null){
    problemDialog.dispose();
  }
  problemDialog = new JDialog();
  ProblemListPanel listPanel = new ProblemListPanel(this);
  problemDialog.add(listPanel);
  problemDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
  problemDialog.pack();
  problemDialog.setMinimumSize(new Dimension(300, 450));
  listPanel.adjustProblemList();
  problemDialog.validate();
}

代码示例来源:origin: javax.help/javahelp

public void setTitle(String title) {
debug("setTitle");
this.title = title;
if (jhelp != null) {
  if (modallyActivated) {
  dialog.setTitle(title);
  dialog.validate();
  } else {
  frame.setTitle(title);
  frame.validate();
  }
}
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public void setCurrentPage(AssistantPage currentPage) {
  this.currentPage = currentPage;
  pagePanel.removeAll();
  titleLabel.setText(currentPage.getPageTitle());
  pagePanel.add(currentPage.getPageComponent(), BorderLayout.CENTER);
  updateState();
  dialog.invalidate();
  dialog.validate();
  dialog.repaint();
}

代码示例来源:origin: bcdev/beam

@Override
public void setCurrentPage(AssistantPage currentPage) {
  this.currentPage = currentPage;
  pagePanel.removeAll();
  titleLabel.setText(currentPage.getPageTitle());
  pagePanel.add(currentPage.getPageComponent(), BorderLayout.CENTER);
  updateState();
  dialog.invalidate();
  dialog.validate();
  dialog.repaint();
}

代码示例来源:origin: undera/jmeter-plugins

protected void repack() {
  JDialog dlgParent = getAssociatedDialog();
  if(dlgParent != null) {
    Dimension newSize = dlgParent.getPreferredSize();
    if(newSize.width < minWidth) {
      newSize.width = minWidth;
    }
    dlgParent.setSize(newSize);
    dlgParent.validate();
  }
}

代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter

protected void repack() {
  JDialog dlgParent = getAssociatedDialog();
  if(dlgParent != null) {
    Dimension newSize = dlgParent.getPreferredSize();
    if(newSize.width < minWidth) {
      newSize.width = minWidth;
    }
    dlgParent.setSize(newSize);
    dlgParent.validate();
  }
}

代码示例来源:origin: undera/jmeter-plugins

public static JDialog getJDialogInstance(Frame owner, String title, boolean modal, JAbsrtactDialogPanel content, String imagePath) {
  if(!GraphicsEnvironment.isHeadless()) {
    JDialog ret = new JDialog(owner, title, modal);
    ret.add(content);
    ret.pack();
    Dimension size = ret.getPreferredSize();
    if(size.width < content.getMinWidth()) {
      size.width = content.getMinWidth();
    }
    ret.setSize(size);
    ret.validate();
    if(imagePath != null) {
      ImageIcon imageIcon = new ImageIcon(DialogFactory.class.getResource(imagePath));
      if(imageIcon != null) {
        ret.setIconImage(imageIcon.getImage());
      }
    }
    return ret;
  } else {
    return null;
  }
}

代码示例来源:origin: cytoscape/application

public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      JComboBox c = (JComboBox) e.getItemSelectable();
      String attrName = (String) c.getSelectedItem();
      updateAttribute(attrName, network, this.mapIndex);
      // change the panel referenced to get a new panel from the
      // mapping
      // to reflect the new mapped attribute.
      remove(this.mapperUI);
      this.mapperUI = ((ObjectMapping) mappings.get(mapIndex)).getUI(this.parent,
                                      network);
      MiscGB.insert(myGBG, this.mapperUI, 0, this.yPos, 3, 1, 2, 2,
             GridBagConstraints.BOTH);
      parent.validate();
    }
  }
}

代码示例来源:origin: cytoscape.corelibs/task

/**
 * Initializes UI.
 */
private void initUI() {
  //  Use  Border Layout
  setLayout(new BorderLayout());
  //  Create North Panel with Error Message and Button.
  JPanel northPanel = createNorthPanel();
  add(northPanel, BorderLayout.NORTH);
  //  Create Center Panel with Error Details.
  JScrollPane centerPanel = createCenterPanel();
  add(centerPanel, BorderLayout.CENTER);
  //  Repack and validate the owner
  owner.pack();
  owner.validate();
}

代码示例来源:origin: javax.help/javahelp

/**
 * Requests the presentation be set to a given size. Updates the
 * the presentation on the fly. This is an override of 
 * Presentation.SetSize.
 */
public void setSize(Dimension d) {
debug("setSize");
super.setSize(d);
if (jhelp != null) {
  if (modallyActivated) {
  dialog.setSize(d);
  dialog.validate();
  } else {
  frame.setSize(d);
  frame.validate();
  }
}
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-tools

@Override
  public void actionPerformed (ActionEvent arg0) {
    if(editor.isUsingDefaultTexture()) {
      JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first.");
      return;
    }
    
    TextureAtlas atlas = editor.getAtlas();
    if(atlas != null)
      regionPickerPanel.setAtlas(atlas);
    else 
      regionPickerPanel.setTexture(editor.getTexture());
    
    regionPickerPanel.revalidate();
    regionPickerPanel.repaint();
    regionSelectDialog.validate();
    regionSelectDialog.repaint();
    regionSelectDialog.pack();
    regionSelectDialog.setVisible(true);
  }
});

相关文章

JDialog类方法