本文整理汇总了Java中org.jdesktop.swingx.JXFrame.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java JXFrame.setVisible方法的具体用法?Java JXFrame.setVisible怎么用?Java JXFrame.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.JXFrame
的用法示例。
在下文中一共展示了JXFrame.setVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interactiveTreeTableRollover
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
public void interactiveTreeTableRollover() {
final JXTreeTable table = new JXTreeTable(treeTableModel);
final CompoundHighlighter compoundHighlighter = new CompoundHighlighter(foregroundHighlighter);
table.setHighlighters(compoundHighlighter);
JXFrame frame = wrapWithScrollingInFrame(table, "TreeTable with rollover");
Action toggleAction = new AbstractAction("toggle foreground/background") {
boolean isBackground;
public void actionPerformed(ActionEvent e) {
if (isBackground) {
compoundHighlighter.addHighlighter(foregroundHighlighter);
compoundHighlighter.removeHighlighter(backgroundHighlighter);
} else {
compoundHighlighter.addHighlighter(backgroundHighlighter);
compoundHighlighter.removeHighlighter(foregroundHighlighter);
}
isBackground = !isBackground;
}
};
addAction(frame, toggleAction);
frame.setVisible(true);
}
示例2: interactiveTableCustomColorRendererWithHighlighter
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Compare xtable using custom color renderer - standard vs. ext.<p>
* Adds highlighter ... running amok.
*/
public void interactiveTableCustomColorRendererWithHighlighter() {
TableModel model = new AncientSwingTeam();
JXTable xtable = new JXTable(model);
xtable.addHighlighter(
HighlighterFactory.createSimpleStriping(HighlighterFactory.GENERIC_GRAY));
xtable.setDefaultRenderer(Color.class, new ColorRenderer(true));
JXTable table = new JXTable(model);
table.addHighlighter(
HighlighterFactory.createSimpleStriping(HighlighterFactory.GENERIC_GRAY));
TableCellRenderer renderer = createColorRendererExt();
table.setDefaultRenderer(Color.class, renderer);
JXFrame frame = wrapWithScrollingInFrame(xtable, table, "JXTable/highlighter: Custom color renderer - standard/ext");
addStatusMessage(frame, "Highlighter hide custom color renderer background for unselected");
frame.setVisible(true);
}
示例3: interactiveTableCustomColorRendererWithHighlighterDontTouch
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Compare xtable using custom color renderer - standard vs. ext.<p>
* Adds highlighter which respects renderer's dont touch.
*/
public void interactiveTableCustomColorRendererWithHighlighterDontTouch() {
TableModel model = new AncientSwingTeam();
JXTable xtable = new JXTable(model);
Highlighter highlighter = createPropertyRespectingHighlighter(
HighlighterFactory.createSimpleStriping(HighlighterFactory.GENERIC_GRAY));
xtable.addHighlighter(highlighter);
xtable.setDefaultRenderer(Color.class, new ColorRenderer(true));
JXTable table = new JXTable(model);
table.addHighlighter(highlighter);
TableCellRenderer renderer = createColorRendererExt();
table.setDefaultRenderer(Color.class, renderer);
JXFrame frame = wrapWithScrollingInFrame(xtable, table, "JXTable/highlighter dont-touch: Custom color renderer - standard/ext");
addStatusMessage(frame, "Highlighter doesn't touch custom color renderer visual properties");
frame.pack();
frame.setVisible(true);
}
示例4: interactiveTableRollover
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
public void interactiveTableRollover() {
JXTable table = new JXTable(sortableTableModel);
final CompoundHighlighter compoundHighlighter = new CompoundHighlighter(foregroundHighlighter);
table.setHighlighters(compoundHighlighter);
JXFrame frame = wrapWithScrollingInFrame(table, "Table with rollover");
Action toggleAction = new AbstractAction("toggle foreground/background") {
boolean isBackground;
public void actionPerformed(ActionEvent e) {
if (isBackground) {
compoundHighlighter.addHighlighter(foregroundHighlighter);
compoundHighlighter.removeHighlighter(backgroundHighlighter);
} else {
compoundHighlighter.addHighlighter(backgroundHighlighter);
compoundHighlighter.removeHighlighter(foregroundHighlighter);
}
isBackground = !isBackground;
}
};
addAction(frame, toggleAction);
frame.setVisible(true);
}
示例5: interactiveTableAndTreeCustomColorRenderingController
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* xtable/xlist using the same custom component controller.<p>
*
*/
public void interactiveTableAndTreeCustomColorRenderingController() {
TableModel tableModel = new AncientSwingTeam();
ComponentProvider<JLabel> controller = createColorRenderingLabelController();
JXTable xtable = new JXTable(tableModel);
xtable.setDefaultRenderer(Color.class, new DefaultTableRenderer(controller));
TreeModel model = createTreeColorModel();
JTree tree = new JTree(model);
ComponentProvider<?> wrapper = new WrappingProvider(controller); //;createColorRenderingLabelController());
TreeCellRenderer renderer = new DefaultTreeRenderer(wrapper);
tree.setCellRenderer(renderer);
JXFrame frame = wrapWithScrollingInFrame(xtable, tree, "JXTable/JXTree: Custom color renderer - sharing the component controller");
addMessage(frame, "share provider in table and in wrappingProvider does not work?");
frame.pack();
frame.setVisible(true);
}
示例6: interactiveDropOnHierachicalColumnBlinks
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Issue #766-swingx: drop image is blinking over hierarchical column.
*
* Core bug: <a
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6700748">#6700748</a>
*
* Hacks around, use one or other:
* - the usual performance optimization (override validate etc to do nothing)
* - rendering component return false on isVisible
*/
public void interactiveDropOnHierachicalColumnBlinks() {
JXTreeTable xTable = new JXTreeTable(new ComponentTreeTableModel(
new JXFrame()));
installTransferHandler(xTable);
xTable.putClientProperty(JXTreeTable.DROP_HACK_FLAG_KEY, Boolean.TRUE);
xTable.expandAll();
xTable.setVisibleColumnCount(10);
JXFrame frame = wrapWithScrollingInFrame(xTable,
"TreeTable hierarchical: blink on drop over?");
JTextField textField = new JTextField(
"drag me over hierarchical column ..");
textField.setDragEnabled(true);
addStatusComponent(frame, textField);
frame.setVisible(true);
}
示例7: interactiveTestColumnControlColumnModel
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Issue ??: Column control on changing column model.
*
*/
public void interactiveTestColumnControlColumnModel() {
final JXTable table = new JXTable(10, 5);
table.setColumnControlVisible(true);
Action toggleAction = new AbstractAction("Set ColumnModel") {
@Override
public void actionPerformed(ActionEvent e) {
table.setColumnModel(new DefaultTableColumnModel());
table.setModel(new AncientSwingTeam());
setEnabled(false);
}
};
JXFrame frame = wrapWithScrollingInFrame(table,
"ColumnControl: set columnModel ext -> core default");
addAction(frame, toggleAction);
frame.setVisible(true);
}
示例8: interactiveTestColumnControlSetModelToggleInvisibleColumns
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Issue #212: programmatically toggle column vis does not work.
*
* Visual check: compare toggle column visibility both via the columnControl
* and programmatically by button. While the columnControl prevents to hide
* the very last visible column, developers have full control to do so
* programatically.
*
*
*/
public void interactiveTestColumnControlSetModelToggleInvisibleColumns() {
final JXTable table = new JXTable();
table.setColumnControlVisible(true);
JXFrame frame = wrapWithScrollingInFrame(table,
"ColumnControl (#212-swingx) setModel and toggle first column invisible");
frame.setVisible(true);
table.setModel(new DefaultTableModel(10, 2));
final TableColumnExt firstNameColumn = table.getColumnExt(1);
Action action = new AbstractAction("Toggle first name visibility") {
@Override
public void actionPerformed(ActionEvent e) {
firstNameColumn.setVisible(!firstNameColumn.isVisible());
}
};
addAction(frame, action);
}
示例9: interactiveDropOnPlainLabelTableBlinks
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Issue #766-swingx: drop image is blinking over hierarchical column.
*
* Check plain JLabel as renderer in Table.
*/
public void interactiveDropOnPlainLabelTableBlinks() {
JXTable xTable = new JXTable(new AncientSwingTeam());
installTransferHandler(xTable);
TableCellRenderer renderer = new TableCellRenderer() {
JLabel label = new JLabel();
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
label.setText(String.valueOf(value));
return label;
}
};
xTable.getColumn(0).setCellRenderer(renderer);
JXFrame frame = wrapWithScrollingInFrame(xTable,
"Plain label as renderer: blink on drop over?");
JTextField textField = new JTextField("drag me over first column....");
textField.setDragEnabled(true);
addStatusComponent(frame, textField);
frame.setVisible(true);
}
示例10: interactiveCompareTreeExtTreeColors
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Custom tree colors in JTree. Compare core default renderer with Swingx
* default renderer.
*
*/
public void interactiveCompareTreeExtTreeColors() {
JTree xtree = new JTree();
Color background = Color.MAGENTA;
Color foreground = Color.YELLOW;
xtree.setBackground(background);
xtree.setForeground(foreground);
DefaultTreeCellRenderer coreTreeCellRenderer = new DefaultTreeCellRenderer();
// to get a uniform color on both tree and node
// the core default renderer needs to be configured
coreTreeCellRenderer.setBackgroundNonSelectionColor(background);
coreTreeCellRenderer.setTextNonSelectionColor(foreground);
xtree.setCellRenderer(coreTreeCellRenderer);
JTree tree = new JTree();
tree.setBackground(background);
tree.setForeground(foreground);
// swingx renderer uses tree colors
tree.setCellRenderer(xTreeRenderer);
final JXFrame frame = wrapWithScrollingInFrame(xtree, tree,
"custom tree colors - core vs. ext renderer");
frame.setVisible(true);
}
示例11: interactiveNullVisibilityActionWithHideable
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* test if subclasses are allowed to not create a visibility action. This
* might happen, if they want to exempt certain columns from user
* interaction.
*
*/
public void interactiveNullVisibilityActionWithHideable() {
JXTable table = new JXTable();
ColumnControlButton columnControl = new ColumnControlButton(table) {
@Override
protected ColumnVisibilityAction createColumnVisibilityAction(
TableColumn column) {
if (column instanceof TableColumnExt
&& !((TableColumnExt) column).isHideable())
return null;
return super.createColumnVisibilityAction(column);
}
};
table.setColumnControl(columnControl);
table.setColumnControlVisible(true);
ColumnFactory factory = new ColumnFactory() {
/**
* @inherited <p>
*/
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (columnExt.getModelIndex() == 0) {
columnExt.setHideable(false);
}
}
};
table.setColumnFactory(factory);
table.setModel(new AncientSwingTeam());
JXFrame frame = wrapWithScrollingInFrame(table,
"first model column not togglable");
frame.setVisible(true);
}
示例12: interactiveListDisabledIconRenderer
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Check disabled appearance.
*
*/
public void interactiveListDisabledIconRenderer() {
final TableModel model = createTableModelWithDefaultTypes();
//
ListModel listModel = new AbstractListModel() {
@Override
public Object getElementAt(int index) {
if (index == 0) {
return "dummy";
}
return model.getValueAt(index - 1, 4);
}
@Override
public int getSize() {
return model.getRowCount() + 1;
}
};
final JList standard = new JList(listModel);
final JList enhanced = new JList(listModel);
enhanced.setCellRenderer(new DefaultListRenderer());
AbstractAction action = new AbstractAction("toggle disabled") {
@Override
public void actionPerformed(ActionEvent e) {
standard.setEnabled(!standard.isEnabled());
enhanced.setEnabled(!enhanced.isEnabled());
}
};
JXFrame frame = wrapWithScrollingInFrame(standard, enhanced, "Disabled - compare renderers: default <--> enhanced");
addAction(frame, action);
frame.setVisible(true);
}
示例13: interactiveTableDefaultRenderers
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Check disabled appearance for all renderers.
*
*/
public void interactiveTableDefaultRenderers() {
TableModel model = createTableModelWithDefaultTypes();
final JTable standard = new JTable(model);
// used as source for swingx renderers
final JXTable xTable = new JXTable();
final JTable enhanced = new JTable(model) {
@Override
protected void createDefaultRenderers() {
defaultRenderersByColumnClass = new UIDefaults();
setDefaultRenderer(Object.class, xTable.getDefaultRenderer(Object.class));
setDefaultRenderer(Number.class, xTable.getDefaultRenderer(Number.class));
setDefaultRenderer(Date.class, xTable.getDefaultRenderer(Date.class));
setDefaultRenderer(Icon.class, xTable.getDefaultRenderer(Icon.class));
setDefaultRenderer(ImageIcon.class, xTable.getDefaultRenderer(ImageIcon.class));
setDefaultRenderer(Boolean.class, xTable.getDefaultRenderer(Boolean.class));
}
};
AbstractAction action = new AbstractAction("toggle disabled") {
@Override
public void actionPerformed(ActionEvent e) {
standard.setEnabled(!standard.isEnabled());
enhanced.setEnabled(!enhanced.isEnabled());
}
};
JXFrame frame = wrapWithScrollingInFrame(standard, enhanced, "Disabled Compare renderers: default <--> enhanced");
addAction(frame, action);
frame.setVisible(true);
}
示例14: interactiveRenderingLabel
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* Style.None - use case? Always invisible?
*/
public void interactiveRenderingLabel() {
JComponent box = Box.createVerticalBox();
final JXLabel label = new JXLabel("setup: ShapePainter with fillstyle none");
// fixed: NPE with null shape - but has default instead of null?
final ShapePainter styleNone = new ShapePainter();
styleNone.setStyle(ShapePainter.Style.NONE);
label.setBackgroundPainter(styleNone);
box.add(label);
final JXLabel label2 = new JXLabel("setup: default ShapePainter");
final ShapePainter painter = new ShapePainter();
label2.setBackgroundPainter(painter);
box.add(label2);
Action action = new AbstractActionExt("toggle painter visible") {
public void actionPerformed(ActionEvent e) {
styleNone.setVisible(!styleNone.isVisible());
painter.setVisible(!painter.isVisible());
label.repaint();
label2.repaint();
}
};
JXFrame frame = wrapInFrame(box, "renderer label with shape painter - fillstyle none");
addAction(frame, action);
frame.pack();
frame.setVisible(true);
}
示例15: getRealizedDatePicker
import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
* @return
*/
protected JXDatePicker getRealizedDatePicker() {
JXFrame frame = new JXFrame();
final JXDatePicker picker = new JXDatePicker();
frame.add(new JTextField(10));
frame.add(picker);
frame.add(new JTextField(10));
frame.pack();
frame.setVisible(true);
return picker;
}