本文整理了Java中javax.swing.JLabel.setEnabled()
方法的一些代码示例,展示了JLabel.setEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setEnabled()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setEnabled
暂无
代码示例来源:origin: chewiebug/GCViewer
public void setEnabled(boolean enabled) {
nameLabel.setEnabled(enabled);
valueLabel.setEnabled(enabled);
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void enableTsurgeonHelper(boolean enable) {
scriptLabel.setEnabled(enable);
tsurgeonScript.setEnabled(enable);
tsurgeonHelp.setEnabled(enable);
cancelTsurgeon.setEnabled(false);//should always be off unless we're running a script
runScript.setEnabled(enable);
tsurgeonEnabled = enable;
TregexGUI.getInstance().setTsurgeonEnabled(enable);
}
代码示例来源:origin: skylot/jadx
public void addRow(String label, String tooltip, JComponent comp) {
c.gridy = row++;
JLabel jLabel = new JLabel(label);
jLabel.setLabelFor(comp);
jLabel.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 0;
c.gridwidth = 1;
c.anchor = GridBagConstraints.LINE_START;
c.weightx = 0.8;
c.fill = GridBagConstraints.NONE;
add(jLabel, c);
c.gridx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.2;
c.fill = GridBagConstraints.HORIZONTAL;
if (tooltip != null) {
jLabel.setToolTipText(tooltip);
comp.setToolTipText(tooltip);
}
add(comp, c);
comp.addPropertyChangeListener("enabled", evt -> jLabel.setEnabled((boolean) evt.getNewValue()));
}
代码示例来源:origin: pmd/pmd
private void adjustLanguageControlsFor(LanguageConfig current) {
ignoreIdentifiersCheckbox.setEnabled(current.canIgnoreIdentifiers());
ignoreLiteralsCheckbox.setEnabled(current.canIgnoreLiterals());
ignoreAnnotationsCheckbox.setEnabled(current.canIgnoreAnnotations());
ignoreUsingsCheckbox.setEnabled(current.canIgnoreUsings());
extensionField.setText(current.extensions()[0]);
boolean enableExtension = current.extensions()[0].length() == 0;
extensionField.setEnabled(enableExtension);
extensionLabel.setEnabled(enableExtension);
}
代码示例来源:origin: kiegroup/optaplanner
private void createUI() {
JPanel labelAndDeletePanel = new JPanel(new BorderLayout(5, 0));
if (employee != null) {
labelAndDeletePanel.add(new JLabel(nurseRosteringPanel.getEmployeeIcon()), BorderLayout.WEST);
}
JLabel employeeLabel = new JLabel(getEmployeeLabel());
employeeLabel.setEnabled(false);
labelAndDeletePanel.add(employeeLabel, BorderLayout.CENTER);
if (employee != null) {
JPanel deletePanel = new JPanel(new BorderLayout());
deleteButton = SwingUtils.makeSmallButton(new JButton(nurseRosteringPanel.getDeleteEmployeeIcon()));
deleteButton.setToolTipText("Delete");
deleteButton.addActionListener(e -> nurseRosteringPanel.deleteEmployee(employee));
deletePanel.add(deleteButton, BorderLayout.NORTH);
labelAndDeletePanel.add(deletePanel, BorderLayout.EAST);
}
labelAndDeletePanel.setPreferredSize(new Dimension(WEST_HEADER_WIDTH,
(int) labelAndDeletePanel.getPreferredSize().getHeight()));
add(labelAndDeletePanel, BorderLayout.WEST);
resetShiftListPanel();
numberOfShiftAssignmentsLabel = new JLabel("0 assignments", JLabel.RIGHT);
numberOfShiftAssignmentsLabel.setPreferredSize(new Dimension(EAST_HEADER_WIDTH, 20));
numberOfShiftAssignmentsLabel.setEnabled(false);
add(numberOfShiftAssignmentsLabel, BorderLayout.EAST);
}
代码示例来源:origin: kiegroup/optaplanner
labelAndDeletePanel.setPreferredSize(new Dimension(150, 20));
machineLabel = new JLabel(getMachineLabel());
machineLabel.setEnabled(false);
labelAndDeletePanel.add(machineLabel, BorderLayout.CENTER);
if (machine != null) {
numberOfProcessesLabel = new JLabel("0 processes ", JLabel.RIGHT);
numberOfProcessesLabel.setPreferredSize(new Dimension(100, 20));
numberOfProcessesLabel.setEnabled(false);
numberAndDetailsPanel.add(numberOfProcessesLabel, BorderLayout.WEST);
detailsButton = new JButton(new AbstractAction("Details") {
代码示例来源:origin: kiegroup/optaplanner
private void updateBars(boolean used) {
numberOfProcessesLabel.setText(processList.size() + " processes");
numberOfProcessesLabel.setEnabled(used);
cpuPowerBar.setEnabled(used);
cpuPowerBar.repaint();
memoryBar.setEnabled(used);
memoryBar.repaint();
networkBandwidthBar.setEnabled(used);
networkBandwidthBar.repaint();
detailsButton.setEnabled(used);
}
代码示例来源:origin: kiegroup/optaplanner
private void updateTotals(int usedCpuPower, int usedMemory, int usedNetworkBandwidth, boolean used) {
computerLabel.setEnabled(used);
cpuPowerField.setText(usedCpuPower + " GHz / " + getComputerCpuPower() + " GHz");
cpuPowerField.setForeground(usedCpuPower > getComputerCpuPower() ? TangoColorFactory.SCARLET_3 : Color.BLACK);
cpuPowerField.setEnabled(used);
memoryField.setText(usedMemory + " GB / " + getComputerMemory() + " GB");
memoryField.setForeground(usedMemory > getComputerMemory() ? TangoColorFactory.SCARLET_3 : Color.BLACK);
memoryField.setEnabled(used);
networkBandwidthField.setText(usedNetworkBandwidth + " GB / " + getComputerNetworkBandwidth() + " GB");
networkBandwidthField.setForeground(usedNetworkBandwidth > getComputerNetworkBandwidth()
? TangoColorFactory.SCARLET_3 : Color.BLACK);
networkBandwidthField.setEnabled(used);
costField.setEnabled(used);
}
代码示例来源:origin: kiegroup/optaplanner
private void updateTotals() {
boolean used = processAssignmentList.size() > 0;
machineLabel.setEnabled(used);
for (MrResource resource : resourceList) {
JTextField resourceField = resourceFieldMap.get(resource);
long maximumCapacity;
long safetyCapacity;
if (machine != null) {
MrMachineCapacity machineCapacity = machine.getMachineCapacity(resource);
maximumCapacity = machineCapacity.getMaximumCapacity();
safetyCapacity = machineCapacity.getSafetyCapacity();
} else {
maximumCapacity = 0L;
safetyCapacity = 0L;
}
long usedTotal = 0L;
for (MrProcessAssignment processAssignment : processAssignmentList) {
usedTotal += processAssignment.getProcess().getProcessRequirement(resource).getUsage();
}
resourceField.setText(usedTotal + " / " + maximumCapacity);
resourceField.setForeground(usedTotal > maximumCapacity ? TangoColorFactory.SCARLET_3 :
(usedTotal > safetyCapacity ? TangoColorFactory.ORANGE_3 : Color.BLACK));
resourceField.setEnabled(used);
}
numberOfProcessesLabel.setText(processAssignmentList.size() + " processes ");
numberOfProcessesLabel.setEnabled(used);
}
代码示例来源:origin: kiegroup/optaplanner
computerLabel.setEnabled(false);
labelAndDeletePanel.add(computerLabel, BorderLayout.CENTER);
if (computer != null) {
代码示例来源:origin: kiegroup/optaplanner
shiftDateLabel.setEnabled(shiftDatePanel.isEnabled());
wrappingShiftDatePanel.add(shiftDateLabel, BorderLayout.NORTH);
wrappingShiftDatePanel.add(shiftDatePanel, BorderLayout.CENTER);
代码示例来源:origin: kiegroup/optaplanner
private void createBarsUI() {
numberOfProcessesLabel = new JLabel(" 0 processes");
numberOfProcessesLabel.setEnabled(false);
numberOfProcessesLabel.setBorder(BorderFactory.createEmptyBorder(0, 37, 0, 0));
add(numberOfProcessesLabel);
cpuPowerBar = new CloudBar(getComputerCpuPower(), cloudBalancingPanel.getMaximumComputerCpuPower());
cpuPowerBar.setEnabled(false);
add(cpuPowerBar);
memoryBar = new CloudBar(getComputerMemory(), cloudBalancingPanel.getMaximumComputerMemory());
memoryBar.setEnabled(false);
add(memoryBar);
networkBandwidthBar = new CloudBar(getComputerNetworkBandwidth(), cloudBalancingPanel.getMaximumComputerNetworkBandwidth());
networkBandwidthBar.setEnabled(false);
add(networkBandwidthBar);
detailsButton = new JButton(new AbstractAction("Details") {
@Override
public void actionPerformed(ActionEvent e) {
CloudProcessListDialog processListDialog = new CloudProcessListDialog();
processListDialog.setLocationRelativeTo(getRootPane());
processListDialog.setVisible(true);
}
});
detailsButton.setEnabled(false);
add(detailsButton);
}
代码示例来源:origin: org.netbeans.api/org-openide-awt
public @Override void setEnabled(boolean b) {
//OptimizeIt shows about 12Ms overhead calling back to Component.enable(), so avoid it if possible
enabled = b;
if (swingRendering) {
super.setEnabled(b);
}
}
代码示例来源:origin: magefree/mage
public void showLanguagesSupport(boolean haveSupport) {
labelLanguage.setEnabled(haveSupport);
comboLanguage.setEnabled(haveSupport);
}
代码示例来源:origin: magefree/mage
private void enableAdvancedPanel(boolean enable) {
adjustingSliderPanel.setEnabled(enable);
btnReset.setEnabled(enable);
cbCMC.setEnabled(enable);
averageCMCLabel.setEnabled(enable);
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void actionPerformed(final ActionEvent e) {
final boolean showModuleConfig = useModuleConfigurationRadio.isSelected();
configurationFilesLabel.setEnabled(showModuleConfig);
configurationFilesCombo.setEnabled(showModuleConfig);
}
}
代码示例来源:origin: magefree/mage
@Override
public void setEnabled(boolean enabled) {
for (JStorageSlider slider : sg.getSliders()) {
slider.setEnabled(enabled);
}
for (JLabel label : textLabels) {
label.setEnabled(enabled);
}
}
代码示例来源:origin: nodebox/nodebox
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
control.setEnabled(enabled);
label.setEnabled(enabled);
}
代码示例来源:origin: winder/Universal-G-Code-Sender
@Override
public void UGSEvent(UGSEvent evt) {
if (evt.isSettingChangeEvent()) {
loadSettings();
}
if (evt.isStateChangeEvent()) {
commandLabel.setEnabled(backend.isIdle());
}
}
代码示例来源:origin: winder/Universal-G-Code-Sender
private void initComponents() {
consoleTextArea.setEditable(false);
consoleTextArea.setColumns(20);
consoleTextArea.setDocument(new LengthLimitedDocument(CONSOLE_SIZE));
consoleTextArea.setRows(5);
consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767));
consoleTextArea.setMinimumSize(new java.awt.Dimension(0, 0));
scrollPane.setViewportView(consoleTextArea);
commandLabel.setEnabled(backend.isIdle());
scrollWindowMenuItem.addActionListener(e -> checkScrollWindow());
setLayout(new MigLayout("inset 0 0 5 0, fill, wrap 1", "", "[][min!]"));
add(scrollPane, "grow, growy");
add(commandLabel, "gapleft 5, al left, split 2");
add(commandTextField, "gapright 5, r, grow");
menu.add(showVerboseMenuItem);
menu.add(scrollWindowMenuItem);
SwingHelpers.traverse(this, (comp) -> comp.setComponentPopupMenu(menu));
}
内容来源于网络,如有侵权,请联系作者删除!