You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.2 KiB
61 lines
1.2 KiB
package de.memtext.dlg; |
|
|
|
import java.awt.Font; |
|
import java.awt.event.ActionListener; |
|
|
|
import javax.swing.JButton; |
|
import javax.swing.JPanel; |
|
|
|
/** |
|
A Panel with an OK and a Cancel button. |
|
*/ |
|
public class OkCancelPanel extends JPanel { |
|
protected JButton btnOk, btnCancel; |
|
|
|
public OkCancelPanel() { |
|
btnOk = new JButton("OK"); |
|
btnCancel = new JButton("Abbrechen"); |
|
btnCancel.setActionCommand("Cancel"); |
|
add(btnOk); |
|
add(btnCancel); |
|
|
|
} |
|
|
|
public void addActionListener(ActionListener al) { |
|
btnOk.addActionListener(al); |
|
btnCancel.addActionListener(al); |
|
} |
|
|
|
/** |
|
* Returns the btnCancel. |
|
* @return JButton |
|
*/ |
|
public JButton getBtnCancel() { |
|
return btnCancel; |
|
} |
|
|
|
/** |
|
* Returns the btnOk. |
|
* @return JButton |
|
*/ |
|
public JButton getBtnOk() { |
|
return btnOk; |
|
} |
|
|
|
public void setOkVisible(boolean b) { |
|
btnOk.setVisible(b); |
|
} |
|
|
|
public void setCancelVisible(boolean b) { |
|
btnCancel.setVisible(b); |
|
} |
|
|
|
public void setOkBold(boolean b) { |
|
Font f = btnOk.getFont(); |
|
if (b) |
|
btnOk.setFont(f.deriveFont(Font.BOLD)); |
|
else |
|
btnOk.setFont(f.deriveFont(Font.PLAIN)); |
|
} |
|
|
|
}
|
|
|