There are 16 code examples for javax.swing.JDialog.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: druid Package: org.dlib.gui
Source Code: ProgressDialog.java (Click to view .java file)
Method Code:
public ProgressDialog(JDialog d,String title){
super(d,title,true);
initDialog();
}
Project Name: icTAKES Package: edu.mayo.bmi.ctakes.main
Source Code: cTAKESCPEGUI.java (Click to view .java file)
Method Code:
public void actionPerformed(ActionEvent ev){
Object source=ev.getSource();
if (source == aboutMenuItem) {
aboutDialog.setVisible(true);
}
else if (source == helpMenuItem) {
JOptionPane.showMessageDialog(cTAKESCPEGUI.this,CpmPanel.HELP_MESSAGE,"Collection Processing Engine Configurator Help",JOptionPane.PLAIN_MESSAGE);
}
else if (source == exitMenuItem) {
this.processWindowEvent(new WindowEvent(this,WindowEvent.WINDOW_CLOSING));
}
}
Project Name: jbidwatcher Package: com.jbidwatcher.ui.commands
Source Code: UserActions.java (Click to view .java file)
Method Code:
private void DoShowTime(Component src,AuctionEntry ae){
AuctionServerInterface as=AuctionServerManager.getInstance().getServer();
if (ae != null) as=ae.getServer();
String prompt="<html><body><table>";
prompt+="<tr><td><b>Current time:</b></td><td>" + new Date() + "</td></tr>";
prompt+="<tr><td><b>Page load time:</td><td>" + as.getPageRequestTime() + "</td></tr>";
prompt+="<tr><td><b>eBay time delta:</td><td>" + as.getServerTimeDelta() + "</td></tr>";
prompt+="</table></body></html>";
JOptionPane jop=new JOptionPane(prompt,JOptionPane.INFORMATION_MESSAGE);
JDialog jdTime=jop.createDialog(src,"Auction Server Time Information");
jdTime.addWindowListener(new WindowAdapter(){
public void windowDeactivated( WindowEvent ev){
ev.getWindow().toFront();
}
}
);
jdTime.setVisible(true);
}
Project Name: megamek Package: megamek.client.ui.swing
Source Code: MechDisplay.java (Click to view .java file)
Method Code:
/**
* Displays the specified entity in the panel.
*/
public void displayEntity(Entity en){
String enName=en.getShortName();
switch (en.getDamageLevel()) {
case Entity.DMG_CRIPPLED:
enName+=" [CRIPPLED]";
break;
case Entity.DMG_HEAVY:
enName+=" [HEAVY DMG]";
break;
case Entity.DMG_MODERATE:
enName+=" [MODERATE DMG]";
break;
case Entity.DMG_LIGHT:
enName+=" [LIGHT DMG]";
break;
default :
enName+=" [UNDAMAGED]";
}
clientgui.mechW.setTitle(enName);
currentlyDisplaying=en;
mPan.displayMech(en);
pPan.displayMech(en);
aPan.displayMech(en);
wPan.displayMech(en);
sPan.displayMech(en);
ePan.displayMech(en);
}
Project Name: megamek Package: megamek.client.ui.swing
Source Code: ClientGUI.java (Click to view .java file)
Method Code:
/**
* Saves the board in PNG image format.
*/
private void boardSaveImage(){
if (curfileBoardImage == null) {
boardSaveAsImage();
return;
}
JDialog waitD=new JDialog(frame,Messages.getString("BoardEditor.waitDialog.title"));
waitD.add(new JLabel(Messages.getString("BoardEditor.waitDialog.message")));
waitD.setSize(250,130);
waitD.setLocation((frame.getSize().width / 2) - (waitD.getSize().width / 2),(frame.getSize().height / 2) - (waitD.getSize().height / 2));
waitD.setVisible(true);
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
waitD.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
int filter=0;
int compressionLevel=9;
PngEncoder png=new PngEncoder(bv.getEntireBoardImage(),PngEncoder.NO_ALPHA,filter,compressionLevel);
try {
FileOutputStream outfile=new FileOutputStream(curfileBoardImage);
byte[] pngbytes;
pngbytes=png.pngEncode();
if (pngbytes == null) {
System.out.println("Failed to save board as image:Null image");
}
else {
outfile.write(pngbytes);
}
outfile.flush();
outfile.close();
}
catch ( IOException e) {
e.printStackTrace();
}
waitD.setVisible(false);
frame.setCursor(Cursor.getDefaultCursor());
}
Project Name: megamek Package: megamek.client.ui.swing
Source Code: BoardEditor.java (Click to view .java file)
Method Code:
void setMapVisible(boolean visible){
minimapW.setVisible(visible);
}
Project Name: rmoffice Package: net.sf.rmoffice.ui
Source Code: RMFrame.java (Click to view .java file)
Method Code:
/**
*/
private void addCurrentSelectedISkill(boolean withModifiedName){
TreePath selectionPath=skillsSelectionTree.getSelectionPath();
if (selectionPath != null) {
Object lastPathComponent=selectionPath.getLastPathComponent();
if (lastPathComponent != null && lastPathComponent instanceof SkillTreeNode) {
SkillTreeNode node=(SkillTreeNode)lastPathComponent;
if (node.getUserObject() instanceof ISkill) {
ISkill skill=(ISkill)node.getUserObject();
if (withModifiedName) {
ModifySkillDialog dialog=new ModifySkillDialog(skill,null);
JOptionPane pane=new JOptionPane(dialog,JideOptionPane.QUESTION_MESSAGE,JideOptionPane.OK_CANCEL_OPTION);
JDialog d=pane.createDialog(RMFrame.this,RESOURCE.getString("ui.skills.btEditBeforeAdd.title"));
pane.selectInitialValue();
d.setVisible(true);
d.dispose();
Object result=pane.getValue();
if (result != null && result instanceof Integer && ((Integer)result).intValue() == JOptionPane.OK_OPTION) {
skillModel.addSkill(skill,dialog.getSkillName(),dialog.getSkillType());
}
}
else if (!sheet.hasSkillRank(skill)) {
skillModel.addSkill(skill);
}
}
}
}
}
Project Name: vfsjfilechooser Package: net.sf.vfsjfilechooser
Source Code: VFSJFileChooser.java (Click to view .java file)
Method Code:
/**
* Called by the UI when the user chooses the Cancel button.
* This can also be called by the programmer.
* This method causes an action event to fire
* with the command string equal to
* <code>CANCEL_SELECTION</code>.
* @see #CANCEL_SELECTION
*/
public void cancelSelection(){
returnValue=RETURN_TYPE.CANCEL;
if (dialog != null) {
dialog.setVisible(false);
}
fireActionPerformed(CANCEL_SELECTION);
}
Project Name: weka Package: weka.gui
Source Code: GenericObjectEditor.java (Click to view .java file)
Method Code:
/**
* sets up the GUI.
*/
protected void initGUI(){
JPanel panel;
CheckBoxListModel model;
setTitle("Filtering Capabilities...");
setLayout(new BorderLayout());
panel=new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
getContentPane().add(panel,BorderLayout.NORTH);
m_InfoLabel.setText("<html>" + m_ClassType.getName().replaceAll(".*\\.","") + "s"+ " have to support <i>at least</i> the following capabilities <br>"+ "(the ones highlighted <font color=\""+ GOETreeNode.NO_SUPPORT+ "\">"+ GOETreeNode.NO_SUPPORT+ "</font> don't meet these requirements <br>"+ "the ones highlighted <font color=\""+ GOETreeNode.MAYBE_SUPPORT+ "\">"+ GOETreeNode.MAYBE_SUPPORT+ "</font> possibly meet them):"+ "</html>");
panel.add(m_InfoLabel,BorderLayout.CENTER);
getContentPane().add(new JScrollPane(m_List),BorderLayout.CENTER);
model=(CheckBoxListModel)m_List.getModel();
for ( Capability cap : Capability.values()) model.addElement(cap);
panel=new JPanel(new FlowLayout(FlowLayout.CENTER));
getContentPane().add(panel,BorderLayout.SOUTH);
m_OkButton.setMnemonic('O');
m_OkButton.addActionListener(new ActionListener(){
public void actionPerformed( ActionEvent e){
updateCapabilities();
if (m_CapabilitiesFilter == null) m_CapabilitiesFilter=new Capabilities(null);
m_CapabilitiesFilter.assign(m_Capabilities);
m_Self.setVisible(false);
showPopup();
}
}
);
panel.add(m_OkButton);
m_CancelButton.setMnemonic('C');
m_CancelButton.addActionListener(new ActionListener(){
public void actionPerformed( ActionEvent e){
m_Self.setVisible(false);
showPopup();
}
}
);
panel.add(m_CancelButton);
pack();
}
Project Name: weka Package: weka.gui
Source Code: GenericObjectEditor.java (Click to view .java file)
Method Code:
public void actionPerformed(ActionEvent e){
m_Self.setVisible(false);
showPopup();
}
Project Name: weka Package: weka.gui
Source Code: PropertySheetPanel.java (Click to view .java file)
Method Code:
/**
* opens the help dialog.
*/
protected void openHelpFrame(){
JTextArea ta=new JTextArea();
ta.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.setEditable(false);
ta.setText(m_HelpText.toString());
ta.setCaretPosition(0);
JDialog jdtmp;
if (PropertyDialog.getParentDialog(this) != null) {
jdtmp=new JDialog(PropertyDialog.getParentDialog(this),"Information");
}
else if (PropertyDialog.getParentFrame(this) != null) {
jdtmp=new JDialog(PropertyDialog.getParentFrame(this),"Information");
}
else {
jdtmp=new JDialog(PropertyDialog.getParentDialog(m_aboutPanel),"Information");
}
final JDialog jd=jdtmp;
jd.addWindowListener(new WindowAdapter(){
public void windowClosing( WindowEvent e){
jd.dispose();
if (m_HelpDialog == jd) {
m_HelpBut.setEnabled(true);
}
}
}
);
jd.getContentPane().setLayout(new BorderLayout());
jd.getContentPane().add(new JScrollPane(ta),BorderLayout.CENTER);
jd.pack();
jd.setSize(400,350);
jd.setLocation(m_aboutPanel.getTopLevelAncestor().getLocationOnScreen().x + m_aboutPanel.getTopLevelAncestor().getSize().width,m_aboutPanel.getTopLevelAncestor().getLocationOnScreen().y);
jd.setVisible(true);
m_HelpDialog=jd;
}
Project Name: weka Package: weka.gui.beans
Source Code: LoaderCustomizer.java (Click to view .java file)
Method Code:
public void actionPerformed(ActionEvent e){
try {
final JDialog jf=new JDialog((JDialog)LoaderCustomizer.this.getTopLevelAncestor(),"Choose file",ModalityType.DOCUMENT_MODAL);
jf.setLayout(new BorderLayout());
jf.getContentPane().add(m_fileChooser,BorderLayout.CENTER);
m_fileChooserFrame=jf;
jf.pack();
jf.setVisible(true);
}
catch ( Exception ex) {
ex.printStackTrace();
}
}
Project Name: weka Package: weka.gui.beans
Source Code: KnowledgeFlowApp.java (Click to view .java file)
Method Code:
/**
* Popup the customizer for this bean
* @param custClass the class of the customizer
* @param bc the bean to be customized
*/
private void popupCustomizer(Class custClass,JComponent bc){
try {
final Object customizer=custClass.newInstance();
if (customizer instanceof EnvironmentHandler) {
((EnvironmentHandler)customizer).setEnvironment(m_flowEnvironment);
}
if (customizer instanceof BeanCustomizer) {
((BeanCustomizer)customizer).setModifiedListener(this);
}
((Customizer)customizer).setObject(bc);
final JDialog d=new JDialog((java.awt.Frame)KnowledgeFlowApp.this.getTopLevelAncestor(),ModalityType.DOCUMENT_MODAL);
d.setLayout(new BorderLayout());
d.getContentPane().add((JComponent)customizer,BorderLayout.CENTER);
if (customizer instanceof CustomizerCloseRequester) {
((CustomizerCloseRequester)customizer).setParentWindow(d);
}
d.addWindowListener(new java.awt.event.WindowAdapter(){
public void windowClosing( java.awt.event.WindowEvent e){
if (customizer instanceof CustomizerClosingListener) {
((CustomizerClosingListener)customizer).customizerClosing();
}
d.dispose();
}
}
);
d.pack();
d.setLocationRelativeTo(KnowledgeFlowApp.this);
d.setVisible(true);
}
catch ( Exception ex) {
ex.printStackTrace();
}
}
Project Name: weka Package: weka.gui.beans
Source Code: SerializedModelSaverCustomizer.java (Click to view .java file)
Method Code:
public void actionPerformed(ActionEvent e){
try {
final JDialog jf=new JDialog((JDialog)SerializedModelSaverCustomizer.this.getTopLevelAncestor(),"Choose directory",ModalityType.DOCUMENT_MODAL);
jf.getContentPane().setLayout(new BorderLayout());
jf.getContentPane().add(m_fileChooser,BorderLayout.CENTER);
m_fileChooserFrame=jf;
jf.pack();
jf.setVisible(true);
}
catch ( Exception ex) {
ex.printStackTrace();
}
}
Project Name: weka Package: weka.gui.beans
Source Code: SaverCustomizer.java (Click to view .java file)
Method Code:
public void actionPerformed(ActionEvent e){
try {
final JDialog jf=new JDialog((JDialog)SaverCustomizer.this.getTopLevelAncestor(),"Choose directory",ModalityType.DOCUMENT_MODAL);
jf.setLayout(new BorderLayout());
jf.getContentPane().add(m_fileChooser,BorderLayout.CENTER);
m_fileChooserFrame=jf;
jf.pack();
jf.setVisible(true);
}
catch ( Exception ex) {
ex.printStackTrace();
}
}
Project Name: weka Package: weka.gui.scripting
Source Code: FileScriptingPanel.java (Click to view .java file)
Method Code:
/**
* Fired when action got executed.
* @param e the event
*/
public void actionPerformed(ActionEvent e){
JDialog dialog;
if (PropertyDialog.getParentDialog(FileScriptingPanel.this) != null) dialog=new JDialog(PropertyDialog.getParentDialog(FileScriptingPanel.this),getName());
else dialog=new JDialog(PropertyDialog.getParentFrame(FileScriptingPanel.this),getName());
dialog.setTitle((String)getValue(Action.NAME));
dialog.getContentPane().setLayout(new BorderLayout());
dialog.getContentPane().add(getAboutPanel());
dialog.pack();
dialog.setLocationRelativeTo(FileScriptingPanel.this);
dialog.setVisible(true);
}