本文整理匯總了Java中javax.swing.JDialog.setResizable方法的典型用法代碼示例。如果您正苦於以下問題:Java JDialog.setResizable方法的具體用法?Java JDialog.setResizable怎麽用?Java JDialog.setResizable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JDialog
的用法示例。
在下文中一共展示了JDialog.setResizable方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showConfigurationDialog
import javax.swing.JDialog; //導入方法依賴的package包/類
private void showConfigurationDialog(ITopologyGenerator generator) {
JDialog dialog = new JDialog();
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
dialog.setLayout(new BorderLayout());
dialog.setTitle(generator.getName());
dialog.add(generator.getConfigurationDialog(), BorderLayout.CENTER);
Rectangle tbounds = this.getBounds();
Rectangle bounds = new Rectangle();
bounds.setSize(generator.getConfigurationDialog().getPreferredSize());
bounds.x = (int) (tbounds.x + 0.5 * tbounds.width - 0.5 * bounds.width);
bounds.y = (int) (tbounds.y + 0.5 * tbounds.height - 0.5 * bounds.height);
dialog.setBounds(bounds);
dialog.setResizable(false);
dialog.setVisible(true);
}
示例2: showProgress
import javax.swing.JDialog; //導入方法依賴的package包/類
public static ProgressDialog showProgress(Component parent, String message)
{
JDialog d = ComponentHelper.createJDialog(parent);
ProgressDialog p = new ProgressDialog(d);
d.getRootPane().setWindowDecorationStyle(JRootPane.INFORMATION_DIALOG);
d.setResizable(false);
d.setContentPane(p);
d.setTitle(message);
d.pack();
d.setLocationRelativeTo(parent);
d.setVisible(true);
return p;
}
示例3: getProgressMonitorContainer
import javax.swing.JDialog; //導入方法依賴的package包/類
/**
* Returns the progress monitor container that is either a JDialog or a JInternFrame.
* @return the progress monitor container
*/
private Container getProgressMonitorContainer() {
if (progressMonitorContainer==null) {
Dimension defaultSize = new Dimension(570, 188);
if (this.parentDesktopPane==null) {
JDialog jDialog = new JDialog(this.owner);
jDialog.setSize(defaultSize);
jDialog.setResizable(false);
if (this.owner==null) {
jDialog.setAlwaysOnTop(true);
}
jDialog.setTitle(this.windowTitle);
if (this.iconImage!=null) {
jDialog.setIconImage(this.iconImage.getImage());
}
jDialog.setContentPane(this.getJContentPane());
jDialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.progressMonitorContainer = jDialog;
this.setLookAndFeel();
} else {
JInternalFrame jInternalFrame = new JInternalFrame();
jInternalFrame.setSize(defaultSize);
jInternalFrame.setResizable(false);
jInternalFrame.setTitle(this.windowTitle);
if (this.iconImage!=null) {
jInternalFrame.setFrameIcon(this.iconImage);
}
jInternalFrame.setContentPane(this.getJContentPane());
jInternalFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.progressMonitorContainer = jInternalFrame;
}
}
return progressMonitorContainer;
}
示例4: main
import javax.swing.JDialog; //導入方法依賴的package包/類
public static void main(String[] args) {
final String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
final JDialog d = new JDialog();
d.setTitle("Flow Label Test");
d.setModal(true);
d.setResizable(true);
d.setLocationRelativeTo(null);
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.add(new FlowLabel(loremIpsum + "\n\n" + loremIpsum));
d.pack();
d.setVisible(true);
}
示例5: createDialog
import javax.swing.JDialog; //導入方法依賴的package包/類
public static JDialog createDialog(Frame owner, String title, String gradientTitle) {
JDialog dialog = new JDialog(owner, title, true);
dialog.setLayout(new BorderLayout());
dialog.add(Guitilities.createGradientTitle(title), BorderLayout.NORTH);
dialog.setLocationRelativeTo(owner);
dialog.setLocationByPlatform(true);
dialog.setResizable(false);
return dialog;
}
示例6: showDialog
import javax.swing.JDialog; //導入方法依賴的package包/類
/**
* Makes the dialog visible and awaits the user's response. Since the dialog
* is modal, this method returns only when the user closes the dialog. The
* return value indicates if the properties have changed.
* @param frame the frame on which the dialog is to be displayed
* @return <code>true</code> if the properties have changed during the
* time the dialog was visible.
*/
public boolean showDialog(Component frame) {
boolean result;
boolean stopDialog;
do {
getContentPane().setValue(null);
getContentPane().setVisible(true);
JDialog dialog = getContentPane().createDialog(frame, createTitle());
dialog.setResizable(true);
dialog.setVisible(true);
dialog.dispose();
Object selectedValue = getContentPane().getValue();
if (this.table.isChanged()) {
if (selectedValue == getOkButton()) {
result = stopDialog = true;
} else {
int abandon = showAbandonDialog();
result = abandon == JOptionPane.YES_OPTION;
stopDialog = abandon != JOptionPane.CANCEL_OPTION;
}
} else {
// nothing was changed during editing
result = false;
stopDialog = true;
}
} while (!stopDialog);
return result;
}
示例7: setEnlargedView
import javax.swing.JDialog; //導入方法依賴的package包/類
/**
* This method shows the enlarged dialog for the current ontology class instances
* in order to provide an easier access for the end user.
*/
private void setEnlargedView() {
JDialog dialog = new JDialog(OntologyVisualisationConfiguration.getOwnerWindow());
dialog.setPreferredSize(new Dimension(100, 200));
dialog.setName("Ontology-Instance-Viewer");
dialog.setTitle(OntologyVisualisationConfiguration.getApplicationTitle() + ": Ontology-Instance-Viewer");
dialog.setModal(true);
dialog.setResizable(true);
dialog.setContentPane(getJContentPane());
// --- Size and center the dialog -----------------
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int diaWidth = (int) (screenSize.width*0.8);
int diaHeight = (int) (screenSize.height * 0.9);
int left = (screenSize.width - diaWidth) / 2;
int top = (screenSize.height - diaHeight) / 2;
dialog.setSize(new Dimension(diaWidth, diaHeight));
dialog.setLocation(left, top);
// --- Remind and remove THIS from the parent -----
this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
Container parentContainer = this.getParent();
parentContainer.remove(this);
parentContainer.validate();
parentContainer.repaint();
// --- Add THIS to the dialog ---------------------
this.removeEnlargeTab();
jPanel4TouchDown.add(this, BorderLayout.CENTER);
dialog.setVisible(true);
// - - - - - - - - - - - - - - - - - - - - - - - -
// - - User-Interaction - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - -
this.addEnlargeTab();
// --- Add THIS again to the parent ---------------
this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
parentContainer.add(this);
parentContainer.validate();
parentContainer.repaint();
}
示例8: showOptionDialog
import javax.swing.JDialog; //導入方法依賴的package包/類
protected int showOptionDialog(JFrame mainFrame, String message,
String title, String[] options, int defaultValue) {
final IntHolder holder = new IntHolder();
final JDialog dialog = new JDialog(mainFrame, true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
holder.value = defaultValue;
JPanel panel = new JPanel(new BorderLayout());
JPanel m = new JPanel(new FlowLayout());
m.add(new JLabel(message));
panel.add(m, BorderLayout.CENTER);
JPanel bottom = new JPanel(new GridLayout(1, 3, 5, 7));
int i = 0;
for (String s : options) {
final int r = i;
JButton button = new JButton(new AbstractAction(s) {
/**
*
*/
private static final long serialVersionUID = 7269041268620864162L;
@Override
public void actionPerformed(ActionEvent e) {
holder.value = r;
dialog.setVisible(false);
}
});
i++;
bottom.add(button);
}
JPanel p = new JPanel(new FlowLayout());
p.add(bottom);
panel.add(p, BorderLayout.SOUTH);
JPanel pane = new JPanel(new FlowLayout());
pane.add(panel);
dialog.setTitle(title);
dialog.setContentPane(pane);
dialog.pack();
dialog.setResizable(false);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
return holder.value;
}
示例9: initialize
import javax.swing.JDialog; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frameSwitchWorkSpace = new JDialog();
frameSwitchWorkSpace.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
frameSwitchWorkSpace.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frameSwitchWorkSpace.setSize(540, 250);
frameSwitchWorkSpace.setLocationRelativeTo(null);
frameSwitchWorkSpace.setFont(new Font("Arial", Font.BOLD, 13));
frameSwitchWorkSpace.setResizable(false);
frameSwitchWorkSpace.setModalExclusionType(ModalExclusionType.TOOLKIT_EXCLUDE);
frameSwitchWorkSpace.setTitle("\u062A\u0628\u062F\u064A\u0644 \u0645\u0633\u0627\u062D\u0629 \u0627\u0644\u0639\u0645\u0644");
frameSwitchWorkSpace.getContentPane().setLayout(new BorderLayout(0, 0));
JPanel panelCenter = new JPanel();
panelCenter.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
JPanel panelNorth = new JPanel();
panelNorth.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
panelNorth.setBackground(Color.WHITE);
panelNorth.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.GRAY));
panelNorth.setLayout(new GridLayout(2, 1, 0, 0));
JLabel lblTitle = new JLabel("\u062A\u0628\u062F\u064A\u0644 \u0645\u0633\u0627\u062D\u0629 \u0627\u0644\u0639\u0645\u0644");
lblTitle.setFont(new Font("Arial", Font.BOLD, 20));
lblTitle.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
lblTitle.setBorder(new EmptyBorder(10, 0, 0, 30));
panelNorth.add(lblTitle);
JLabel lblDescription = new JLabel("\u064A\u0645\u0643\u0646\u0643 \u062D\u0641\u0638 \u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0641\u064A \u0645\u062C\u0644\u062F \u064A\u0633\u0645\u0649 \u0645\u0633\u0627\u062D\u0629 \u0627\u0644\u0639\u0645\u0644");
lblDescription.setVerticalAlignment(SwingConstants.TOP);
lblDescription.setFont(new Font("Arial", Font.BOLD, 14));
lblDescription.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
lblDescription.setBorder(new EmptyBorder(10, 0, 0, 50));
panelNorth.add(lblDescription);
panelCenter.setLayout(new GridLayout(1, 1, 0, 0));
JFilePicker filePicker = new JFilePicker("مساحة العمل", "استعراض...");
filePicker.setBorder(new MatteBorder(45, 1, 1, 1, (Color) new Color(240, 240, 240)));
panelCenter.add(filePicker);
frameSwitchWorkSpace.getContentPane().add(panelCenter, BorderLayout.CENTER);
JPanel panelSouth = new JPanel();
frameSwitchWorkSpace.getContentPane().add(panelSouth);
panelSouth.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
btnCancel = new JButton("إلغاء الأمر");
btnCancel.setFont(new Font("Arial", Font.BOLD, 14));
btnCancel.setHorizontalAlignment(SwingConstants.RIGHT);
panelSouth.add(btnCancel);
btnOK = new JButton("موافق");
btnOK.setHorizontalAlignment(SwingConstants.RIGHT);
btnOK.setFont(new Font("Arial", Font.BOLD, 14));
panelSouth.add(btnOK);
btnCancel.addActionListener(this);
btnOK.addActionListener(this);
frameSwitchWorkSpace.getContentPane().add(panelNorth, BorderLayout.NORTH);
frameSwitchWorkSpace.getContentPane().add(panelCenter, BorderLayout.CENTER);
frameSwitchWorkSpace.getContentPane().add(panelSouth, BorderLayout.SOUTH);
}