/** * Shows a modal font-chooser dialog and blocks until the dialog is hidden. If the user presses * the "OK" button, then this method hides/disposes the dialog and returns the selected color. If * the user presses the "Cancel" button or closes the dialog without pressing "OK", then this * method hides/disposes the dialog and returns <code>null</code>. * * @param parent the parent <code>Component</code> for the dialog * @param title the String containing the dialog's title * @return the selected font or <code>null</code> if the user opted out * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless() returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ public Font showFontDialog(Component parent, String title) { BaseDialog dialog = createDialog(parent, title); if (dialog.ask()) { return getSelectedFont(); } else { return null; } }
@Override protected void onCreate(Bundle savedInstanceState) { mInflater = LayoutInflater.from(getContext()); super.onCreate(savedInstanceState); expand(mTOC); expand(mCurrentPageItem); }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Button okButton = (Button) findViewById(R.id.sl_button_ok); okButton.setOnClickListener(this); }
@Override protected void init() { // TODO Auto-generated method stub super.init(); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(generateView()); }
@Override protected void onDialogClose(int trigger) { // TODO Auto-generated method stub // 可以在对话框中获取输入的文本值 setObject(KEY_TEXT, text.getText().toString().trim()); super.onDialogClose(trigger); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setContentView(R.layout.history_layout); getWindow().setBackgroundDrawableResource(android.R.color.transparent); listView = (ListView) findViewById(R.id.listItems); new AsyncAndGetUser().execute(); }
@Override protected void onCreate(Bundle savedInstanceState) { Log.v("cr3", "creating BookmarksDlg"); // setTitle(mCoolReader.getResources().getString(R.string.win_title_bookmarks)); setCancelable(true); super.onCreate(savedInstanceState); registerForContextMenu(mList); }
/* * (non-Javadoc) * * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ protected void okPressed() { selectedIndices = table.getSelectionIndices(); if (columnValueList.get(selectedIndices[0]) == null) { setResult(null); } else { selectedItems = new Object[table.getSelectionCount()]; for (int i = 0; i < table.getSelectionCount(); i++) { selectedItems[i] = table.getSelection()[i].getData(); } setResult(table.getSelection()); } super.okPressed(); }
@Override public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); if (cmd.equals("...")) { File res = FileChooser.open("Select Database", "Database", "db", new File(getEntryText("File"))); if (res != null) { setEntryText("File", res.getAbsolutePath()); setSelectedRadio("File"); } } else { super.actionPerformed(ae); } }
@Override public void setDialogData(DataWrapper wrapper) { // TODO Auto-generated method stub super.setDialogData(wrapper); text.setText(wrapper.getString(KEY_TEXT)); text.setHint(wrapper.getString(KEY_HINT)); text.setInputType(wrapper.getInt(KEY_INPUT_TYPE).intValue()); String positiveText = wrapper.getString(KEY_POSITIVE_BUTTON_TEXT); String negativeText = wrapper.getString(KEY_NEGATIVE_BUTTON_TEXT); if (!StringUtility.isEmpty(positiveText)) { positiveButton.setText(positiveText); } if (!StringUtility.isEmpty(negativeText)) { negativeButton.setText(negativeText); } }
protected BaseDialog createDialog(Component parent, String title) { BaseDialog dialog; Window window = (parent == null ? JOptionPane.getRootFrame() : SwingUtilities.windowForComponent(parent)); if (window instanceof Frame) { dialog = new BaseDialog((Frame) window, title, true); } else { dialog = new BaseDialog((Dialog) window, title, true); } dialog.setDialogMode(BaseDialog.OK_CANCEL_DIALOG); dialog.getBanner().setVisible(false); dialog.getContentPane().setLayout(new BorderLayout()); dialog.getContentPane().add("Center", this); dialog.pack(); dialog.setLocationRelativeTo(parent); return dialog; }
@Override public void close() { if (finder != null) finder.stop(); super.close(); }