📄 confirmpanel.java
字号:
/**
* Create Customize Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createCustomizeButton (boolean withText)
{
if (withText)
return createCustomizeButton(Msg.getMsg(Env.getCtx(), "Customize"));
return createCustomizeButton(null);
} // createCustomizeButton
/**
* Get Customize Button
* @return Button
*/
public CButton getCustomizeButton()
{
return bCustomize;
} // getCustomizeButton
/**
* Create History Button wlth label text
* @param text text
* @return button
*/
public static final CButton createHistoryButton (String text)
{
CButton history = new DialogButton (A_HISTORY, text, Env.getImageIcon("HistoryX24.gif"), 0);
// F9 = History
history.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0), A_HISTORY);
history.getActionMap().put(A_HISTORY, history.getAction());
return history;
} // createHistoryButton
/**
* Create History Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createHistoryButton (boolean withText)
{
if (withText)
return createHistoryButton(Msg.getMsg(Env.getCtx(), "History"));
return createHistoryButton(null);
} // createHistoryButton
/**
* Get History Button
* @return Button
*/
public CButton getHistoryButton()
{
return bHistory;
} // getHistoryButton
/**
* Create Zoom Button wlth label text
* @param text text
* @return button
*/
public static final CButton createZoomButton (String text)
{
return new DialogButton (A_ZOOM, text, Env.getImageIcon("Zoom24.gif"), KeyEvent.VK_Z);
} // createZoomButton
/**
* Create Zoom Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createZoomButton (boolean withText)
{
if (withText)
return createZoomButton(Msg.getMsg(Env.getCtx(), "Zoom"));
return createZoomButton(null);
} // createZoomButton
/**
* Get Zoom Button
* @return Button
*/
public CButton getZoomButton()
{
return bZoom;
} // getZoomyButton
/*************************************************************************/
/**
* Create Process Button wlth label text
* @param text text
* @return button
*/
public static final CButton createProcessButton (String text)
{
return new DialogButton (A_PROCESS, text, Env.getImageIcon("Process24.gif"), 0);
} // createProcessButton
/**
* Create Process Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createProcessButton (boolean withText)
{
if (withText)
return createProcessButton(Msg.getMsg(Env.getCtx(), "Process"));
return createProcessButton(null);
} // createProcessButton
/**
* Create Print Button wlth label text
* @param text text
* @return button
*/
public static final CButton createPrintButton (String text)
{
return new DialogButton (A_PRINT, text, Env.getImageIcon("Print24.gif"), KeyEvent.VK_P);
} // createPrintButton
/**
* Create Print Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createPrintButton (boolean withText)
{
if (withText)
return createPrintButton(Msg.getMsg(Env.getCtx(), "Print"));
return createPrintButton(null);
} // createPrintButton
/**
* Create Help Button wlth label text
* @param text text
* @return Button
*/
public static final CButton createHelpButton (String text)
{
CButton help = new DialogButton (A_HELP, text, Env.getImageIcon("Help24.gif"), KeyEvent.VK_H);
// F1 = Help
help.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), A_HELP);
help.getActionMap().put(A_HELP, help.getAction());
return help;
} // createHelpButton
/**
* Create Help Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createHelpButton (boolean withText)
{
if (withText)
return createHelpButton(Msg.getMsg(Env.getCtx(), "Help"));
return createHelpButton(null);
} // createHelpButton
/**
* Create Export Button wlth label text
* @param text text
* @return Button
*/
public static final CButton createExportButton (String text)
{
return new DialogButton (A_EXPORT, text, Env.getImageIcon("Export24.gif"), 0);
} // createExportButton
/**
* Create Export Button wlth Standard text
* @param withText with text
* @return Button
*/
public static final CButton createExportButton (boolean withText)
{
if (withText)
return createExportButton(Msg.getMsg(Env.getCtx(), "Export"));
return createExportButton(null);
} // createExportButton
/**
* Create OK Button with label text
* @param text text
* @return OK Button
*/
public static final CButton createDeleteButton (String text)
{
CButton dButton = new DialogButton (A_DELETE, text, Env.getImageIcon("Delete24.gif"), KeyEvent.VK_O);
return dButton;
} // createDeleteButton
/**
* Create OK Button with Standard text
* @param withText with text
* @return OK Button
*/
public static final CButton createDeleteButton (boolean withText)
{
if (withText)
return createDeleteButton(Msg.getMsg(Env.getCtx(), A_DELETE));
return createDeleteButton(null);
} // createDeleteButton
/*************************************************************************/
/**
* Add Action Listener
* @param al listener
*/
public void addActionListener(ActionListener al)
{
bOK.addActionListener(al);
bCancel.addActionListener(al);
//
if (bRefresh != null)
bRefresh.addActionListener(al);
if (bCustomize != null)
bCustomize.addActionListener(al);
if (bHistory != null)
bHistory.addActionListener(al);
if (bZoom != null)
bZoom.addActionListener(al);
} // addActionListener
/**
* Enable all components
* @param enabled trie if enabled
*/
public void setEnabled (boolean enabled)
{
super.setEnabled(enabled);
bOK.setEnabled(enabled);
bCancel.setEnabled(enabled);
//
if (bRefresh != null)
bRefresh.setEnabled(enabled);
if (bCustomize != null)
bCustomize.setEnabled(enabled);
if (bHistory != null)
bHistory.setEnabled(enabled);
if (bZoom != null)
bZoom.setEnabled(enabled);
} // setEnabled
/*************************************************************************/
/**
* Dialog Button
*/
public static class DialogButton extends CButton
{
/**
* Create Dialog Button
* @param action action command
* @param toolTipText toole tip text
* @param icon icon
* @param mnemonic mnemonic
*/
public DialogButton (String action, String toolTipText, Icon icon, int mnemonic)
{
super (new DialogAction (action, toolTipText, icon, mnemonic));
super.setMargin(s_insets);
super.setDefaultCapable(false);
} // DialogButton
/**
* Add Action Listener
* @param al listener
*/
public void addActionListener(ActionListener al)
{
// if delegate is set and action listener is set, target.actionPerformed is
// called twice. If only delegate is set, nothing happens.
// It seems that the button is not 'registered' with the Action.
// if (getAction() != null)
// ((DialogAction)getAction()).setDelegate(al);
super.addActionListener(al);
} // addActionListener
} // DialogButton
/**
* Dialog Button Action
*/
public static class DialogAction extends AbstractAction
{
/**
* Create Dialog Action
* @param action action command
* @param toolTipText tool tip text
* @param icon icon
* @param mnemonic mnemonic
*/
public DialogAction (String action, String toolTipText, Icon icon, int mnemonic)
{
super ();
// Attributes
// putValue(Action.NAME, text); // Display
putValue(Action.SMALL_ICON, icon);
putValue(Action.SHORT_DESCRIPTION, toolTipText); // Tooltip
putValue(Action.ACTION_COMMAND_KEY, action);
if (mnemonic != 0)
putValue(Action.MNEMONIC_KEY, new Integer(mnemonic));
} // DialogAction
/** Target ActionListener */
private ActionListener m_delegate = null;
/**
* Set Action Listener for this Button
* @param al listener
*/
public void setDelegate (ActionListener al)
{
m_delegate = al;
} // setDelegate
/**
* ActionListener - call Delegate
* @param e event
*/
public void actionPerformed (ActionEvent e)
{
// System.out.println(">>> Action: actionPerformed");
if (m_delegate != null)
m_delegate.actionPerformed(e);
} // actionPerformed
} // DialogAction
} // ConfirmPanel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -