本文整理匯總了Java中java.awt.Checkbox類的典型用法代碼示例。如果您正苦於以下問題:Java Checkbox類的具體用法?Java Checkbox怎麽用?Java Checkbox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Checkbox類屬於java.awt包,在下文中一共展示了Checkbox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paint
import java.awt.Checkbox; //導入依賴的package包/類
@Override
public void paint(Graphics g) {
Rectangle r = getBounds();
g.setColor(Color.lightGray);
g.draw3DRect(0, 0, r.width, r.height, false);
int n = getComponentCount();
for (int i = 0; i < n; i++) {
Component comp = getComponent(i);
if (comp instanceof Checkbox) {
Point loc = comp.getLocation();
Dimension d = comp.getSize();
g.setColor(comp.getForeground());
g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1);
}
}
}
示例2: HashPreferences
import java.awt.Checkbox; //導入依賴的package包/類
public HashPreferences() {
setLayout(null);
explanation = new MessagePanel(
"Enables files to be hashed in the background so they can be downloaded with multi source download.\n\n"
+ "NOTE: Files stop hashing after the current one.");
explanation.setLocation(0, 0);
explanation.setSize(STD_XSIZE, STD_YSIZE / 2 - CHECKBOX_Y_SIZE);
add(explanation);
enableHashing = new Checkbox("Enabling File Hashing");
enableHashing.setLocation(50, STD_YSIZE / 2 - CHECKBOX_Y_SIZE);
enableHashing.setSize(STD_XSIZE - 50, CHECKBOX_Y_SIZE);
add(enableHashing);
setSize(STD_XSIZE, STD_YSIZE);
}
示例3: main
import java.awt.Checkbox; //導入依賴的package包/類
/**
* Run a demonstration.
*
* @param args ignored.
*
* @throws Exception when an error occurs.
*/
public static void main(final String[] args) throws Exception {
final Frame frame = new Frame();
final Panel panel = new Panel();
panel.setLayout(new RadialLayout());
panel.add(new Checkbox("One"));
panel.add(new Checkbox("Two"));
panel.add(new Checkbox("Three"));
panel.add(new Checkbox("Four"));
panel.add(new Checkbox("Five"));
panel.add(new Checkbox("One"));
panel.add(new Checkbox("Two"));
panel.add(new Checkbox("Three"));
panel.add(new Checkbox("Four"));
panel.add(new Checkbox("Five"));
frame.add(panel);
frame.setSize(300, 500);
frame.setVisible(true);
}
示例4: getPermissionsPanel
import java.awt.Checkbox; //導入依賴的package包/類
public JPanel getPermissionsPanel(){
JPanel permissionsPanel = new JPanel();
Font labelFont = new Font("SansSerif", Font.BOLD, 12);
Border paddingBorder = BorderFactory.createEmptyBorder(5,5,5,5);
JLabel labelPerm = new JLabel("Permissions"); labelPerm.setFont(labelFont); labelPerm.setBorder(paddingBorder); labelPerm.setAlignmentX(Component.LEFT_ALIGNMENT);
permissionsPanel.setLayout(new BoxLayout(permissionsPanel, BoxLayout.Y_AXIS));
permissionsPanel.add(labelPerm);
JPanel permCBPanel = new JPanel();
permCBPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
permCBPanel.setLayout(new GridLayout(0,2));
for(SeqDataUser u : users){
Checkbox cb = new Checkbox(u.getName(), sharedUsers.containsKey(u.getName()) && sharedUsers.get(u.getName()));
if(u.isAdmin())
cb.setEnabled(false);
userCheckboxes.put(u, cb);
permCBPanel.add(cb);
}
permissionsPanel.add(permCBPanel);
permissionsPanel.add(Box.createVerticalGlue());
return permissionsPanel;
}
示例5: WebPanel
import java.awt.Checkbox; //導入依賴的package包/類
protected WebPanel(JmolViewer viewer, JFileChooser fc, WebPanel[] webPanels,
int panelIndex) {
this.viewer = viewer;
this.fc = fc;
this.webPanels = webPanels;
this.panelIndex = panelIndex;
theWidgets = new Widgets();
nWidgets = theWidgets.widgetList.length;
widgetCheckboxes = new Checkbox[nWidgets];
// Create the text fields for the path to the Jmol applet, page author(s)
// name(s) and web page title.
remoteAppletPath = new JTextField(20);
remoteAppletPath.addActionListener(this);
remoteAppletPath.setText(WebExport.getAppletPath(true));
localAppletPath = new JTextField(20);
localAppletPath.addActionListener(this);
localAppletPath.setText(WebExport.getAppletPath(false));
pageAuthorName = new JTextField(20);
pageAuthorName.addActionListener(this);
pageAuthorName.setText(WebExport.getPageAuthorName());
webPageTitle = new JTextField(20);
webPageTitle.addActionListener(this);
webPageTitle.setText(GT._("A web page containing Jmol applets"));
}
示例6: dialogItemChanged
import java.awt.Checkbox; //導入依賴的package包/類
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
chosenFilter = gd.getNextChoice();
chosenRadius = (double) gd.getNextNumber();
chosenIteration = (int) gd.getNextNumber();
Checkbox previewCheckbox = (Checkbox) gd.getCheckboxes().get(0);
if (gd.invalidNumber() || chosenRadius<=0 || chosenRadius>3 || chosenIteration<1 || chosenIteration>500) {
if (previewCheckbox.getState()) {
previewCheckbox.setSize(130, 20);
previewCheckbox.setLabel("Invalid number");
}
return false;
} else {
return true;
}
}
示例7: itemStateChanged
import java.awt.Checkbox; //導入依賴的package包/類
public void itemStateChanged(ItemEvent check) {
// Process the Checkboxes. First get the components
// of the panel loopPanel and store in a Component
// array (Note: the method getComponents()
// is inherited from the Container class by the
// subclass Panel).
Component [] components = loopPanel.getComponents();
// Now process these components. First cast each
// Component to a Checkbox. Then use the getState()
// method of Checkbox to return boolean true if
// checked and false otherwise, and act accordingly.
// Since in this case the two checkboxes are exclusive
// (only one can be true), we only need to process
// one of them to know what to do.
gp.loopFlag = ((Checkbox) components[1]).getState();
}
示例8: addCheckBoxes
import java.awt.Checkbox; //導入依賴的package包/類
private void addCheckBoxes() {
activeFeedbackCheckbox = new Checkbox("");
activeFeedbackCheckbox.setFocusable(false);
activeFeedbackCheckbox.setState(cfg.getIsActiveFeedbackEnabled());
activeFeedbackCheckbox.setBackground(COLOR_UI_BACKGROUND);
activeFeedbackCheckbox.setBounds(BOUNDS_ACTIVE_FEEDBACK_CHECKBOX);
getContentPane().add(activeFeedbackCheckbox);
defaultCollatedCheckbox = new Checkbox("");
defaultCollatedCheckbox.setFocusable(false);
defaultCollatedCheckbox.setState(cfg.getIsDefaultCollated());
defaultCollatedCheckbox.setBackground(COLOR_UI_BACKGROUND);
defaultCollatedCheckbox.setBounds(new Rectangle(846, 40, 25, 25));
getContentPane().add(defaultCollatedCheckbox);
}
示例9: configurationSwitchesCreate
import java.awt.Checkbox; //導入依賴的package包/類
void configurationSwitchesCreate() {
switchesLowerPanel.removeAll();
switchesUpperPanel.removeAll();
for (Iterator i = config.getSwitches().entrySet().iterator(); i.hasNext(); ) {
Entry e = (Entry) i.next();
final String name = (String) e.getKey();
final String setting = (String) e.getValue();
final Checkbox check = new Checkbox(name);
//check.setFont(new Font("Monospaced", Font.PLAIN, 11));
check.setFont(new Font("Dialog", Font.PLAIN, 14));
check.setState(setting.equals("on") ? true : false);
if (name.length() < 4) {
switchesUpperPanel.add(check);
} else {
switchesLowerPanel.add(check);
}
}
}
示例10: queryAdditionalParameters
import java.awt.Checkbox; //導入依賴的package包/類
@Override
public void queryAdditionalParameters( final GenericDialog gd )
{
gd.addChoice( "ImgLib2_container_FFTs", BoundingBoxGUI.imgTypes, BoundingBoxGUI.imgTypes[ defaultFFTImgType ] );
gd.addCheckbox( "Save_memory (not keep FFT's on CPU, 2x time & 0.5x memory)", defaultSaveMemory );
saveMem = (Checkbox)gd.getCheckboxes().lastElement();
gd.addChoice( "Type_of_iteration", iterationTypeString, iterationTypeString[ defaultIterationType ] );
it = (Choice)gd.getChoices().lastElement();
gd.addChoice( "Image_weights", weightsString, weightsString[ defaultWeightType ] );
weight = (Choice)gd.getChoices().lastElement();
gd.addChoice( "OSEM_acceleration", osemspeedupChoice, osemspeedupChoice[ defaultOSEMspeedupIndex ] );
gd.addNumericField( "Number_of_iterations", defaultNumIterations, 0 );
gd.addCheckbox( "Debug_mode", defaultDebugMode );
gd.addCheckbox( "Adjust_blending_parameters (if stripes are visible)", defaultAdjustBlending );
gd.addCheckbox( "Use_Tikhonov_regularization", defaultUseTikhonovRegularization );
gd.addNumericField( "Tikhonov_parameter", defaultLambda, 4 );
gd.addChoice( "Compute", blocksChoice, blocksChoice[ defaultBlockSizeIndex ] );
block = (Choice)gd.getChoices().lastElement();
gd.addChoice( "Compute_on", computationOnChoice, computationOnChoice[ defaultComputationTypeIndex ] );
gpu = (Choice)gd.getChoices().lastElement();
gd.addChoice( "PSF_estimation", extractPSFChoice, extractPSFChoice[ defaultExtractPSF ] );
gd.addChoice( "PSF_display", displayPSFChoice, displayPSFChoice[ defaultDisplayPSF ] );
}
示例11: itemStateChanged
import java.awt.Checkbox; //導入依賴的package包/類
public void itemStateChanged(ItemEvent e)
{
Object actioner = e.getSource();
if (actioner == null)
return;
if ((Checkbox) actioner == subRandomSamplesCheckbox)
{
updateNumberOfSamples();
return;
}
if (setResultsOptionsCheckbox.getState())
{
setResultsOptionsCheckbox.setState(false);
setResultsOptions();
updateNumberOfSamples();
}
}
示例12: createFrame
import java.awt.Checkbox; //導入依賴的package包/類
private void createFrame()
{
setLayout(mainGrid);
// Build a grid that shows the last pressed position.
labels = new Label[6];
ImagePlus imp = getCurrentImage();
String title = (imp == null) ? "" : imp.getTitle();
createLabelPanel(labels[0] = new Label(), "Image", title);
createLabelPanel(labels[1] = new Label(), "X", "");
createLabelPanel(labels[2] = new Label(), "Y", "");
createLabelPanel(labels[3] = new Label(), "Z", "");
createLabelPanel(labels[4] = new Label(), "C", "");
createLabelPanel(labels[5] = new Label(), "T", "");
overlayCheckbox = new Checkbox("Overlay", true);
add(overlayCheckbox, 0, 1);
}
示例13: edit
import java.awt.Checkbox; //導入依賴的package包/類
public static boolean edit(Component parent, Line line) {
// TODO Auto-generated method stub
lineEditor.line.setLineType(line.getLineType());
lineEditor.line.setLineWidth(line.getLineWidth());
lineEditor.line.setInVisible(line.isInVisible());
lineEditor.cbHide.setSelected(line.isInVisible());
((Checkbox)lineEditor.typeCheckBoxes.get(line.getLineType())).setState(true);
((Checkbox)lineEditor.widthCheckBoxes.get(line.getLineWidth()-1)).setState(true);
if (ModalDialog.doModal(parent, lineEditor, StringResource.getString("lineEditorTitle"))) {
line.setLineType(lineEditor.line.getLineType());
line.setLineWidth(lineEditor.line.getLineWidth());
line.setInVisible(lineEditor.line.isInVisible());
return true;
} return false;
}
示例14: agregar
import java.awt.Checkbox; //導入依賴的package包/類
/**
*
*/
private int agregar(String nombreServidor, String version, String ip,
String id) {
Checkbox check = new Checkbox("", true, grupoConexiones);
PanelConexion p = new PanelConexion(check, nombreServidor, version, ip,
id, ++claveEntrada);
Integer clave = new Integer(claveEntrada);
int cant = panelConexiones.getComponentCount();
tablaConexiones.put(clave, p);
tablaCheckbox.put(check, p);
if (cant > 0) {
layout.setRows(cant + 1);
}
panelConexiones.add(p);
panelConexiones.validate();
validate();
return claveEntrada;
}
示例15: queryOptions
import java.awt.Checkbox; //導入依賴的package包/類
public boolean queryOptions() {
MesquiteInteger buttonPressed = new MesquiteInteger(1);
String help = "If you select \"minimize objection function\", then Mesquite will search for trees that have smaller values of the number calculated for each tree; if you turn this option off, Mesquite will look for trees with larger values. ";
help+="For example, if Treelength were the value calculated for each tree, one typically would search for trees with smaller values; i.e., one would choose \"minimize objection function\".";
help+= " If \"live updates\" is chosen, then each time a better tree is found, the tree will be redrawn (if it is visible in a tree window) and any calculations based upon the tree,";
help+=" such as tracing of a character history, a tree legend, or a chart, will be redone, which may substantially increase the time taken for the search.";
ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), "Options for Search for Better Tree",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
dialog.appendToHelpString(help);
dialog.addLabel("Options for Search for Better Tree");
Checkbox smallerIsBetterBox = dialog.addCheckBox("minimize objection function", smallerIsBetter);
Checkbox liveUpdatesBox = dialog.addCheckBox("update display and calculations based upon tree as it is rearranged", liveUpdates);
dialog.completeAndShowDialog(true);
if (buttonPressed.getValue()==0) {
smallerIsBetter = smallerIsBetterBox.getState();
liveUpdates = liveUpdatesBox.getState();
//storePreferences();
}
dialog.dispose();
return (buttonPressed.getValue()==0);
}