List of usage examples for javax.swing DebugGraphics BUFFERED_OPTION
int BUFFERED_OPTION
To view the source code for javax.swing DebugGraphics BUFFERED_OPTION.
Click Source Link
Frame
. From source file:DebugGraphicsDemo.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton bn = new JButton(); RepaintManager repaintManager = RepaintManager.currentManager(bn); repaintManager.setDoubleBufferingEnabled(false); bn.setDebugGraphicsOptions(/* w w w . j a v a2 s.com*/ DebugGraphics.BUFFERED_OPTION | DebugGraphics.FLASH_OPTION | DebugGraphics.LOG_OPTION); frame.add(bn); frame.setSize(300, 300); frame.setVisible(true); frame.add(bn); }
From source file:gtu._work.ui.JSFMakerUI_attrDialog.java
private void initGUI() { try {// w ww . j a va 2s . c o m final SwingActionUtil actionUtil = SwingActionUtil.newInstance(this); BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("attribute", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(379, 233)); { DefaultTableModel model = JTableUtil.createModel(true, "enable", "attribute", "value"); attrTable = new JTable(); //XXX defnine attribute model.addRow(transfromAttribute(new Attribute("size", null, "", new String[] { "", "3", "5", "10", "15", "20" }))); model.addRow(transfromAttribute( new Attribute("readonly", null, "", new String[] { "", "false", "true" }))); model.addRow(transfromAttribute( new Attribute("styleClass", null, "", new String[] { "", "readonly-input" }))); //XXX defnine attribute jScrollPane1.setViewportView(attrTable); attrTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); attrTable.setAutoscrolls(true); attrTable.setAutoCreateRowSorter(false); attrTable.setUpdateSelectionOnSort(false); attrTable.setAutoCreateColumnsFromModel(true); attrTable.setColumnSelectionAllowed(true); attrTable.setModel(model); attrTable.getTableHeader().setAutoscrolls(true); attrTable.getTableHeader().setDebugGraphicsOptions(DebugGraphics.BUFFERED_OPTION); attrTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { actionUtil.invokeAction(evt); } }); attrTable.addKeyListener(JTableUtil.newInstance(attrTable).defaultKeyAdapter()); } } { confirmOk = new JButton(); jPanel1.add(confirmOk, BorderLayout.SOUTH); confirmOk.setText("OK"); confirmOk.setPreferredSize(new java.awt.Dimension(379, 32)); confirmOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionUtil.invokeAction(evt); } }); } } actionUtil.addAction(confirmOk, ActionEvent.class, new Action() { public void action(EventObject evt) throws Exception { dispose(); setVisible(false); } }); actionUtil.addAction(attrTable, MouseEvent.class, new Action() { public void action(EventObject evt) throws Exception { if (!JMouseEventUtil.buttonLeftClick(2, evt)) { return; } int colPos = JTableUtil.newInstance(attrTable).getSelectedColumn(); int rowPos = JTableUtil.newInstance(attrTable).getSelectedRow(); Function func = Function.valueOf(colPos); if (func == null) { System.err.println("ERROR!!!!!"); return; } Attribute realAttr = (Attribute) JTableUtil.newInstance(attrTable).getModel() .getValueAt(rowPos, Function.VALUE.col); switch (func) { case ENABLE: boolean bool = (Boolean) JTableUtil.newInstance(attrTable).getModel().getValueAt(rowPos, Function.ENABLE.col); JTableUtil.newInstance(attrTable).getModel().setValueAt(!bool, rowPos, Function.ENABLE.col); break; case ATTRIBUTE: break; case VALUE: String value = (String) JOptionPaneUtil.newInstance().showInputDialog_drowdown("choice", "", realAttr.dropdown, realAttr.defaultVal); realAttr.value = value; JTableUtil.newInstance(attrTable).getModel().setValueAt(StringUtils.isNotEmpty(value), rowPos, Function.ENABLE.col); break; } } }); } setSize(400, 300); } catch (Exception e) { e.printStackTrace(); } }