本文整理匯總了Java中javax.swing.JComponent.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.setEnabled方法的具體用法?Java JComponent.setEnabled怎麽用?Java JComponent.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.setEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: started
import javax.swing.JComponent; //導入方法依賴的package包/類
void started() {
started = true;
((CardLayout) progress.getLayout()).show(progress, "progress");
progress.invalidate();
//disable all elements in the dialog:
List<JComponent> todo = new LinkedList<JComponent>();
todo.add(this);
while (!todo.isEmpty()) {
JComponent c = todo.remove(0);
if (c == progress) continue;
c.setEnabled(false);
for (Component child : c.getComponents()) {
if (child instanceof JComponent) todo.add((JComponent) child);
}
}
}
示例2: setEditDatasEnabled
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* 設置所有查詢條件控件是否有效
*
* @param i_Visible
*/
public void setEditDatasEnabled(boolean i_Enabled)
{
// 先設置事情源本身
this.myself.setEnabled(i_Enabled);
Iterator<?> v_Iterator = this.editDatas.values().iterator();
while ( v_Iterator.hasNext() )
{
Object v_QueryCondition = v_Iterator.next();
if ( v_QueryCondition instanceof JComponent )
{
JComponent v_QC = (JComponent)v_QueryCondition;
v_QC.setEnabled(i_Enabled);
}
}
}
示例3: getTableCellRendererComponent
import javax.swing.JComponent; //導入方法依賴的package包/類
public Component getTableCellRendererComponent(JTable jTable, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
boolean joinTable = false;
boolean validClass = true;
boolean existentUpdate = false;
String problemDisplayName = null;
if (jTable.getModel() instanceof TableClassNamesModel) {
TableClassNamesModel model = (TableClassNamesModel)jTable.getModel();
Table table = model.getTableAt(row);
joinTable = table.isJoin();
if (column == 1) {
existentUpdate = table.getDisabledReason() instanceof Table.ExistingDisabledReason;
validClass = model.isValidClass(table);
if (!validClass) {
problemDisplayName = model.getProblemDisplayName(table);
}
}
}
Object realValue = null;
if (joinTable && column == 1) {
realValue = NbBundle.getMessage(TableUISupport.class, "LBL_JoinTable");
} else {
realValue = value;
}
JComponent component = (JComponent)super.getTableCellRendererComponent(jTable, realValue, isSelected, hasFocus, row, column);
component.setEnabled(!joinTable && !existentUpdate);
component.setToolTipText(joinTable ? NbBundle.getMessage(TableUISupport.class, "LBL_JoinTableDescription") : problemDisplayName);
component.setForeground((validClass) ? nonErrorForeground : errorForeground);
return component;
}
示例4: updateEnabledState
import javax.swing.JComponent; //導入方法依賴的package包/類
private void updateEnabledState() {
boolean foldEnable = preferences.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true);
boolean useDefaults = preferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true);
for (JComponent c : controls) {
FoldType ft = (FoldType)c.getClientProperty("type"); // NOI18N
boolean enable = true;
if (defaultPrefs != null && useDefaults) {
enable = !isDefinedDefault(ft);
}
enable &= foldEnable;
c.setEnabled(enable);
}
}
示例5: setEnabled
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
protected void setEnabled (boolean enabled) {
for (JComponent inputField : inputFields) {
inputField.setEnabled(enabled);
}
if (enabled) {
updateAuthSelection();
}
}
示例6: initialize
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* Set up component.
*/
protected void initialize() {
JComponent component = getComponent();
component.setToolTipText(label.getToolTipText());
component.setEnabled(editable);
component.setOpaque(false);
}
示例7: ExportDiffPanel
import javax.swing.JComponent; //導入方法依賴的package包/類
/** Creates new form ExportDiffPanel */
public ExportDiffPanel(JComponent attachComponent) {
initComponents();
this.attachComponent = attachComponent;
asFileRadioButton.addActionListener(this);
attachRadioButton.addActionListener(this);
attachPanel.add(attachComponent);
attachComponent.setEnabled(false);
fileTextField.setEnabled(true);
}
示例8: getTableCellRendererComponent
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
TableCellRenderer def = table.getDefaultRenderer(table.getColumnClass(column));
if (!table.isEnabled()) {
isSelected = hasFocus = false;
}
JComponent c = (JComponent)def.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
c.setEnabled(table.isEnabled());
return c;
}
示例9: getTableCellRendererComponent
import javax.swing.JComponent; //導入方法依賴的package包/類
public Component getTableCellRendererComponent(JTable jTable, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
boolean joinTable = false;
boolean validClass = true;
String problemDisplayName = null;
if (jTable.getModel() instanceof TableClassNamesModel) {
TableClassNamesModel model = (TableClassNamesModel)jTable.getModel();
Table table = model.getTableAt(row);
joinTable = table.isJoin();
if (column == 1) {
validClass = model.isValidClass(table);
if (!validClass) {
problemDisplayName = model.getProblemDisplayName(table);
}
}
}
Object realValue = null;
if (joinTable && column == 1) {
realValue = NbBundle.getMessage(TableUISupport.class, "LBL_JoinTable");
} else {
realValue = value;
}
JComponent component = (JComponent)super.getTableCellRendererComponent(jTable, realValue, isSelected, hasFocus, row, column);
component.setEnabled(!joinTable);
component.setToolTipText(joinTable ? NbBundle.getMessage(TableUISupport.class, "LBL_JoinTableDescription") : problemDisplayName);
component.setForeground((validClass) ? nonErrorForeground : errorForeground);
return component;
}
示例10: enableControls
import javax.swing.JComponent; //導入方法依賴的package包/類
private void enableControls (boolean enabled) {
for (JComponent c : new JComponent[] {
panel.txtFilter,
panel.btnUpdate,
panel.tagList,
panel.btnRemove }) {
c.setEnabled(enabled);
}
}
示例11: setQueryConditionsEnabled
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* 設置所有查詢條件控件是否有效
*
* 當 i_Enabled 為真時,對特別控件有業務邏輯判斷
*
* @param i_Enabled
*/
public void setQueryConditionsEnabled(boolean i_Enabled)
{
// 先設置事情源本身
$myself.setEnabled(i_Enabled);
Iterator<?> v_Iterator = this.queryConditionMap.values().iterator();
while ( v_Iterator.hasNext() )
{
Object v_QueryCondition = v_Iterator.next();
if ( v_QueryCondition instanceof JComponent )
{
JComponent v_QC = (JComponent)v_QueryCondition;
v_QC.setEnabled(i_Enabled);
}
}
boolean v_Enable = false;
if ( i_Enabled )
{
// 設置過濾查詢按鈕的可用性
String v_FileName = ((JComboBox)XJava.getObject("FamilyName")).getSelectedItem().toString();
String v_ColumnName = ((JComboBox)XJava.getObject("ColumnName")).getSelectedItem().toString();
if ( !JavaHelp.isNull(v_FileName) && !JavaHelp.isNull(v_ColumnName) )
{
v_Enable = true;
}
}
((JComponent)XJava.getObject("xbSubmit")) .setEnabled(i_Enabled);
((JComponent)XJava.getObject("xbSubmitFilter")).setEnabled(v_Enable);
}
示例12: getRenderer
import javax.swing.JComponent; //導入方法依賴的package包/類
/** Get a renderer component appropriate to a given property */
public JComponent getRenderer(Property prop) {
mdl.setProperty(prop);
env.reset();
PropertyEditor editor = preparePropertyEditor(mdl, env);
if (editor instanceof ExceptionPropertyEditor) {
return getExceptionRenderer((Exception) editor.getValue());
}
JComponent result = null;
try {
if (editor.isPaintable()) {
result = prepareString(editor, env);
} else {
Class c = mdl.getPropertyType();
if ((c == Boolean.class) || (c == boolean.class)) {
//Special handling for hinting for org.netbeans.beaninfo.BoolEditor
boolean useRadioRenderer = useRadioBoolean ||
(env.getFeatureDescriptor().getValue("stringValues") != null); //NOI18N
if (useRadioRenderer) {
result = prepareRadioButtons(editor, env);
} else {
result = prepareCheckbox(editor, env);
}
} else if (editor.getTags() != null) {
String[] s = editor.getTags();
boolean editAsText = Boolean.TRUE.equals(prop.getValue("canEditAsText"));
if ((s.length <= radioButtonMax) && !editAsText) {
result = prepareRadioButtons(editor, env);
} else {
result = prepareCombobox(editor, env);
}
} else {
result = prepareString(editor, env);
}
}
if ((result != radioRenderer) && (result != textFieldRenderer)) {
if ((result != checkboxRenderer) && tableUI && !(result instanceof JComboBox)) {
result.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
} else if ((result instanceof JComboBox) && tableUI) {
result.setBorder(BorderFactory.createEmptyBorder());
} else if (!(result instanceof JComboBox) && (!(result instanceof JCheckBox))) {
result.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
}
}
} catch (Exception e) {
result = getExceptionRenderer(e);
Logger.getLogger(RendererFactory.class.getName()).log(Level.WARNING, null, e);
}
result.setEnabled(prop.canWrite());
boolean propRequestsSuppressButton = Boolean.TRUE.equals(prop.getValue("suppressCustomEditor")); //NOI18N
if (
!(result instanceof JLabel) &&
((env.getState() == env.STATE_INVALID) || (prop.getValue("valueIcon") != null))
) { //NOI18N
result = prepareIconPanel(editor, env, (InplaceEditor) result);
}
/* If we need a custom editor button, embed the resulting component in
an instance of ButtonPanel and return that */
if (
editor.supportsCustomEditor() && !PropUtils.noCustomButtons && !suppressButton &&
!propRequestsSuppressButton
) {
ButtonPanel bp = buttonPanel();
bp.setInplaceEditor((InplaceEditor) result);
result = bp;
}
return result;
}
示例13: setEnabled
import javax.swing.JComponent; //導入方法依賴的package包/類
private void setEnabled (boolean enabled) {
for (JComponent inputField : inputFields) {
inputField.setEnabled(enabled);
}
repository.setEnabled(enabled);
}
示例14: selectLibrary
import javax.swing.JComponent; //導入方法依賴的package包/類
private void selectLibrary (Node[] nodes) {
int tabCount = this.properties.getTabCount();
for (int i=0; i<tabCount; i++) {
this.properties.removeTabAt(0);
}
this.libraryName.setEnabled(false);
this.libraryName.setText(""); //NOI18N
this.jLabel1.setVisible(false);
this.libraryName.setVisible(false);
this.properties.setVisible(false);
this.deleteButton.setEnabled(false);
if (nodes.length != 1) {
return;
}
LibraryImplementation impl = nodes[0].getLookup().lookup(LibraryImplementation.class);
if (impl == null) {
return;
}
this.jLabel1.setVisible(true);
this.libraryName.setVisible(true);
this.properties.setVisible(true);
boolean editable = model.isLibraryEditable (impl);
this.libraryName.setEnabled(editable && LibrariesSupport.supportsDisplayName(impl));
this.deleteButton.setEnabled(editable);
this.libraryName.setText (LibrariesSupport.getLocalizedName(impl));
LibraryTypeProvider provider = nodes[0].getLookup().lookup(LibraryTypeProvider.class);
if (provider == null) {
return;
}
LibraryCustomizerContextWrapper customizerContext;
LibraryStorageArea area = nodes[0].getLookup().lookup(LibraryStorageArea.class);
if (area != LibraryStorageArea.GLOBAL) {
customizerContext = new LibraryCustomizerContextWrapper(impl, area);
File f = Utilities.toFile(URI.create(area.getLocation().toExternalForm()));
this.libraryLocation.setText(f.getPath());
} else {
customizerContext = new LibraryCustomizerContextWrapper(impl, null);
this.libraryLocation.setText(LABEL_Global_Libraries());
}
String[] volumeTypes = provider.getSupportedVolumeTypes();
for (int i=0; i< volumeTypes.length; i++) {
Customizer c = provider.getCustomizer (volumeTypes[i]);
if (c instanceof JComponent) {
c.setObject (customizerContext);
JComponent component = (JComponent) c;
component.setEnabled (editable);
String tabName = component.getName();
if (tabName == null) {
tabName = volumeTypes[i];
}
this.properties.addTab(tabName, component);
}
}
}
示例15: getJComponent
import javax.swing.JComponent; //導入方法依賴的package包/類
public JComponent getJComponent() {
JComponent comp = super.getJComponent();
comp.setEnabled(possible);
return comp;
}