List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:FontPicker.java
public FontChooser(Frame parent) { super(parent, "Font Chooser", true); setSize(450, 450);//from w w w. j a va 2 s . com attributes = new SimpleAttributeSet(); // Make sure that any way the user cancels the window does the right // thing addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { closeAndCancel(); } }); // Start the long process of setting up our interface Container c = getContentPane(); JPanel fontPanel = new JPanel(); fontName = new JComboBox(new String[] { "TimesRoman", "Helvetica", "Courier" }); fontName.setSelectedIndex(1); fontName.addActionListener(this); fontSize = new JTextField("12", 4); fontSize.setHorizontalAlignment(SwingConstants.RIGHT); fontSize.addActionListener(this); fontBold = new JCheckBox("Bold"); fontBold.setSelected(true); fontBold.addActionListener(this); fontItalic = new JCheckBox("Italic"); fontItalic.addActionListener(this); fontPanel.add(fontName); fontPanel.add(new JLabel(" Size: ")); fontPanel.add(fontSize); fontPanel.add(fontBold); fontPanel.add(fontItalic); c.add(fontPanel, BorderLayout.NORTH); // Set up the color chooser panel and attach a change listener so that // color // updates get reflected in our preview label. colorChooser = new JColorChooser(Color.black); colorChooser.getSelectionModel().addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { updatePreviewColor(); } }); c.add(colorChooser, BorderLayout.CENTER); JPanel previewPanel = new JPanel(new BorderLayout()); previewLabel = new JLabel("Here's a sample of this font."); previewLabel.setForeground(colorChooser.getColor()); previewPanel.add(previewLabel, BorderLayout.CENTER); // Add in the Ok and Cancel buttons for our dialog box JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { closeAndSave(); } }); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { closeAndCancel(); } }); JPanel controlPanel = new JPanel(); controlPanel.add(okButton); controlPanel.add(cancelButton); previewPanel.add(controlPanel, BorderLayout.SOUTH); // Give the preview label room to grow. previewPanel.setMinimumSize(new Dimension(100, 100)); previewPanel.setPreferredSize(new Dimension(100, 100)); c.add(previewPanel, BorderLayout.SOUTH); }
From source file:InternalFrameListenerDemo.java
public InternalFrameListenerDemo() { setTitle("Animated InternalFrameListener"); m_count = m_tencount = 0;//from w w w.j a v a 2 s .c om JPanel innerListenerPanel = new JPanel(new GridLayout(7, 1)); JPanel listenerPanel = new JPanel(new BorderLayout()); m_ifEventCanvas = new IFEventCanvas(); m_lOpened = new JLabel("internalFrameOpened"); m_lClosing = new JLabel("internalFrameClosing"); m_lClosed = new JLabel("internalFrameClosed"); m_lIconified = new JLabel("internalFrameIconified"); m_lDeiconified = new JLabel("internalFrameDeiconified"); m_lActivated = new JLabel("internalFrameActivated"); m_lDeactivated = new JLabel("internalFrameDeactivated"); innerListenerPanel.add(m_lOpened); innerListenerPanel.add(m_lClosing); innerListenerPanel.add(m_lClosed); innerListenerPanel.add(m_lIconified); innerListenerPanel.add(m_lDeiconified); innerListenerPanel.add(m_lActivated); innerListenerPanel.add(m_lDeactivated); listenerPanel.add("Center", m_ifEventCanvas); listenerPanel.add("West", innerListenerPanel); listenerPanel.setOpaque(true); listenerPanel.setBackground(Color.white); m_desktop = new JDesktopPane(); m_desktop.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); m_newFrame = new JButton("New Frame"); m_newFrame.addActionListener(this); m_infos = UIManager.getInstalledLookAndFeels(); String[] LAFNames = new String[m_infos.length]; for (int i = 0; i < m_infos.length; i++) { LAFNames[i] = m_infos[i].getName(); } m_UIBox = new JComboBox(LAFNames); m_UIBox.addActionListener(this); JPanel topPanel = new JPanel(true); topPanel.setLayout(new FlowLayout()); topPanel.setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new SoftBevelBorder(BevelBorder.RAISED)))); getContentPane().setLayout(new BorderLayout()); getContentPane().add("North", topPanel); getContentPane().add("Center", m_desktop); getContentPane().add("South", listenerPanel); ((JPanel) getContentPane()).setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(1, 1, 1, 1), new SoftBevelBorder(BevelBorder.RAISED)))); topPanel.add(m_newFrame); topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT)); topPanel.add(m_UIBox); setSize(645, 500); Dimension dim = getToolkit().getScreenSize(); setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2); setVisible(true); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); m_eventTimer = new Timer(1000, this); m_eventTimer.setRepeats(true); m_eventTimer.start(); }
From source file:FileTable2.java
public BigRenderer(double t) { threshold = t; setHorizontalAlignment(JLabel.RIGHT); setHorizontalTextPosition(SwingConstants.RIGHT); }
From source file:com.aw.core.format.FillerFormat.java
public static String fillFormat(String source, char fillerCharacter, int length, int aligment, boolean fillInclusiveEmptyString) { if (StringUtils.isEmpty(source)) return source; if (source.length() > length) return source.substring(0, length); //throw new AWBusinessException("No se puede llenar '"+source+"' pues tamao excede "+length); source = source.trim();/*from w w w . j a va 2 s . co m*/ if (source.length() == length) return source; if (!fillInclusiveEmptyString && source.length() == 0) return source; if (source.length() > length) return source.substring(0, length); StringBuffer buf = new StringBuffer(length); if (aligment == SwingConstants.CENTER) { int left = (length - source.length()) / 2; int right = length - (source.length() + left); fill(buf, fillerCharacter, left); buf.append(source); fill(buf, fillerCharacter, right); } else { if (aligment == SwingConstants.LEFT) buf.append(source); fill(buf, fillerCharacter, length - source.length()); if (aligment == SwingConstants.RIGHT) buf.append(source); } return buf.toString(); }
From source file:LicenseGenerator.java
/** * Initialize the contents of the frame. *//*w w w. java 2 s . c o m*/ private void initialize() { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException ex) { } m_frame = new JFrame(); m_frame.setTitle("License?"); m_frame.setResizable(false); m_frame.setBounds(100, 100, 496, 483); m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); m_frame.getContentPane().setLayout(null); chkDate = new JCheckBox("?"); chkDate.setSelected(true); chkDate.setBounds(6, 6, 103, 23); m_frame.getContentPane().add(chkDate); txtDate = new JTextField(); txtDate.setText("20131231"); txtDate.setHorizontalAlignment(SwingConstants.RIGHT); txtDate.setBounds(131, 7, 193, 21); m_frame.getContentPane().add(txtDate); txtDate.setColumns(10); chkAdapterNum = new JCheckBox("???"); chkAdapterNum.setSelected(true); chkAdapterNum.setBounds(6, 37, 119, 23); m_frame.getContentPane().add(chkAdapterNum); txtAdapterNum = new JTextField(); txtAdapterNum.setText("000012"); txtAdapterNum.setHorizontalAlignment(SwingConstants.RIGHT); txtAdapterNum.setColumns(10); txtAdapterNum.setBounds(131, 38, 193, 21); m_frame.getContentPane().add(txtAdapterNum); chkAdapter = new JCheckBox( "??? (?? ???)"); chkAdapter.setSelected(true); chkAdapter.setBounds(6, 76, 465, 23); m_frame.getContentPane().add(chkAdapter); chkHTTP_C = new JCheckBox("http.c"); chkHTTP_C.setSelected(true); chkHTTP_C.setBounds(43, 130, 76, 23); m_frame.getContentPane().add(chkHTTP_C); txtHTTP_C = new JTextField(); txtHTTP_C.setText("20131231"); txtHTTP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtHTTP_C.setBounds(131, 131, 103, 21); m_frame.getContentPane().add(txtHTTP_C); txtHTTP_C.setColumns(10); chkSOAP_C = new JCheckBox("soap.c"); chkSOAP_C.setSelected(true); chkSOAP_C.setBounds(43, 161, 76, 23); m_frame.getContentPane().add(chkSOAP_C); txtSOAP_C = new JTextField(); txtSOAP_C.setText("20131231"); txtSOAP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtSOAP_C.setColumns(10); txtSOAP_C.setBounds(131, 162, 103, 21); m_frame.getContentPane().add(txtSOAP_C); chkTCP_C = new JCheckBox("tcp.c"); chkTCP_C.setSelected(true); chkTCP_C.setBounds(43, 192, 76, 23); m_frame.getContentPane().add(chkTCP_C); txtTCP_C = new JTextField(); txtTCP_C.setText("20131231"); txtTCP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtTCP_C.setColumns(10); txtTCP_C.setBounds(131, 193, 103, 21); m_frame.getContentPane().add(txtTCP_C); chkUDP_C = new JCheckBox("udp.c"); chkUDP_C.setSelected(true); chkUDP_C.setBounds(43, 223, 76, 23); m_frame.getContentPane().add(chkUDP_C); txtUDP_C = new JTextField(); txtUDP_C.setText("20131231"); txtUDP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtUDP_C.setColumns(10); txtUDP_C.setBounds(131, 224, 103, 21); m_frame.getContentPane().add(txtUDP_C); chkTUXEDO_C = new JCheckBox("tuxedo.c"); chkTUXEDO_C.setSelected(true); chkTUXEDO_C.setBounds(43, 254, 76, 23); m_frame.getContentPane().add(chkTUXEDO_C); txtTUXEDO_C = new JTextField(); txtTUXEDO_C.setText("20131231"); txtTUXEDO_C.setHorizontalAlignment(SwingConstants.RIGHT); txtTUXEDO_C.setColumns(10); txtTUXEDO_C.setBounds(131, 255, 103, 21); m_frame.getContentPane().add(txtTUXEDO_C); chkMQ_C = new JCheckBox("mq.c"); chkMQ_C.setSelected(true); chkMQ_C.setBounds(43, 286, 76, 23); m_frame.getContentPane().add(chkMQ_C); txtMQ_C = new JTextField(); txtMQ_C.setText("20131231"); txtMQ_C.setHorizontalAlignment(SwingConstants.RIGHT); txtMQ_C.setColumns(10); txtMQ_C.setBounds(131, 287, 103, 21); m_frame.getContentPane().add(txtMQ_C); chkHTTP_S = new JCheckBox("http.s"); chkHTTP_S.setSelected(true); chkHTTP_S.setBounds(283, 130, 76, 23); m_frame.getContentPane().add(chkHTTP_S); txtHTTP_S = new JTextField(); txtHTTP_S.setText("20131231"); txtHTTP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtHTTP_S.setColumns(10); txtHTTP_S.setBounds(368, 130, 103, 21); m_frame.getContentPane().add(txtHTTP_S); chkSOAP_S = new JCheckBox("soap.s"); chkSOAP_S.setSelected(true); chkSOAP_S.setBounds(283, 161, 76, 23); m_frame.getContentPane().add(chkSOAP_S); txtSOAP_S = new JTextField(); txtSOAP_S.setText("20131231"); txtSOAP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtSOAP_S.setColumns(10); txtSOAP_S.setBounds(368, 161, 103, 21); m_frame.getContentPane().add(txtSOAP_S); chkTCP_S = new JCheckBox("tcp.s"); chkTCP_S.setSelected(true); chkTCP_S.setBounds(283, 192, 76, 23); m_frame.getContentPane().add(chkTCP_S); txtTCP_S = new JTextField(); txtTCP_S.setText("20131231"); txtTCP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtTCP_S.setColumns(10); txtTCP_S.setBounds(368, 192, 103, 21); m_frame.getContentPane().add(txtTCP_S); chkUDP_S = new JCheckBox("udp.s"); chkUDP_S.setSelected(true); chkUDP_S.setBounds(283, 223, 76, 23); m_frame.getContentPane().add(chkUDP_S); txtUDP_S = new JTextField(); txtUDP_S.setText("20131231"); txtUDP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtUDP_S.setColumns(10); txtUDP_S.setBounds(368, 223, 103, 21); m_frame.getContentPane().add(txtUDP_S); chkTUXEDO_S = new JCheckBox("tuxedo.s"); chkTUXEDO_S.setSelected(true); chkTUXEDO_S.setBounds(283, 254, 76, 23); m_frame.getContentPane().add(chkTUXEDO_S); txtTUXEDO_S = new JTextField(); txtTUXEDO_S.setText("20131231"); txtTUXEDO_S.setHorizontalAlignment(SwingConstants.RIGHT); txtTUXEDO_S.setColumns(10); txtTUXEDO_S.setBounds(368, 254, 103, 21); m_frame.getContentPane().add(txtTUXEDO_S); chkMQ_S = new JCheckBox("mq.s"); chkMQ_S.setSelected(true); chkMQ_S.setBounds(283, 286, 76, 23); m_frame.getContentPane().add(chkMQ_S); txtMQ_S = new JTextField(); txtMQ_S.setText("20131231"); txtMQ_S.setHorizontalAlignment(SwingConstants.RIGHT); txtMQ_S.setColumns(10); txtMQ_S.setBounds(368, 286, 103, 21); m_frame.getContentPane().add(txtMQ_S); JLabel lblAdapterType1 = new JLabel("???"); lblAdapterType1.setBounds(43, 105, 115, 15); m_frame.getContentPane().add(lblAdapterType1); JLabel lblAdapterType2 = new JLabel("??"); lblAdapterType2.setBounds(283, 105, 103, 15); m_frame.getContentPane().add(lblAdapterType2); JLabel lblAdapterDate1 = new JLabel("?"); lblAdapterDate1.setHorizontalAlignment(SwingConstants.RIGHT); lblAdapterDate1.setBounds(168, 106, 66, 15); m_frame.getContentPane().add(lblAdapterDate1); JLabel lblAdapterDate2 = new JLabel("?"); lblAdapterDate2.setHorizontalAlignment(SwingConstants.RIGHT); lblAdapterDate2.setBounds(405, 105, 66, 15); m_frame.getContentPane().add(lblAdapterDate2); JButton cmdLicense = new JButton("?license"); cmdLicense.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cmdLicense_click(e); } }); cmdLicense.setBounds(302, 332, 169, 23); m_frame.getContentPane().add(cmdLicense); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(6, 367, 478, 82); m_frame.getContentPane().add(scrollPane); txtLicense = new JTextArea(); txtLicense.setEditable(false); scrollPane.setViewportView(txtLicense); }
From source file:de.codesourcery.eve.skills.ui.components.impl.planning.ResourceStatusComponent.java
@Override protected JPanel createPanel() { final JPanel result = new JPanel(); table.setFillsViewportHeight(true);/* ww w . j a va2s. c o m*/ table.setRowSorter(model.getRowSorter()); FixedBooleanTableCellRenderer.attach(table); table.setDefaultRenderer(Integer.class, new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (!(value instanceof Integer)) { return this; } if (column == 0) { setHorizontalAlignment(SwingConstants.LEFT); } else { setHorizontalAlignment(SwingConstants.RIGHT); } Integer amount = (Integer) value; if (amount.intValue() < 0) { if (!isSelected) { setBackground(Color.RED); } else { setBackground(table.getSelectionBackground()); } } else { setBackground(table.getBackground()); } return this; } }); addToShoppingListButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final List<ItemWithQuantity> items = model.getSelectedItems(); if (items.isEmpty()) { return; } final ShoppingListEditorComponent comp = new ShoppingListEditorComponent(title, "", items); comp.setModal(true); ComponentWrapper.wrapComponent(comp).setVisible(true); if (!comp.wasCancelled() && !comp.getShoppingList().isEmpty()) { shoppingListManager.addShoppingList(comp.getShoppingList()); getComponentCallback().dispose(ResourceStatusComponent.this); } } }); new GridLayoutBuilder() .add(new GridLayoutBuilder.VerticalGroup(new GridLayoutBuilder.Cell(new JScrollPane(table)), new GridLayoutBuilder.FixedCell(addToShoppingListButton))) .addTo(result); return result; }
From source file:be.ugent.maf.cellmissy.gui.controller.load.generic.area.GenericAreaImagedPlateController.java
/** * Show Area values in table/*from w ww . java 2 s . c o m*/ */ public void showRawDataInTable() { LoadFromGenericInputPlatePanel loadFromGenericInputPlatePanel = genericImagedPlateController .getLoadFromGenericInputPlatePanel(); //table binding timeStepsTableBinding = SwingBindings.createJTableBinding(AutoBinding.UpdateStrategy.READ, timeStepsBindingList, loadFromGenericInputPlatePanel.getRawDataTable()); //add column bindings JTableBinding.ColumnBinding columnBinding = timeStepsTableBinding .addColumnBinding(ELProperty.create("${wellHasImagingType.well.columnNumber}")); columnBinding.setColumnName("Column"); columnBinding.setEditable(false); columnBinding.setColumnClass(Integer.class); columnBinding = timeStepsTableBinding .addColumnBinding(ELProperty.create("${wellHasImagingType.well.rowNumber}")); columnBinding.setColumnName("Row"); columnBinding.setEditable(false); columnBinding.setColumnClass(Integer.class); columnBinding = timeStepsTableBinding .addColumnBinding(ELProperty.create("${wellHasImagingType.algorithm.algorithmName}")); columnBinding.setColumnName("Algorithm"); columnBinding.setEditable(false); columnBinding.setColumnClass(String.class); columnBinding.setRenderer(new AlignedTableRenderer(SwingConstants.RIGHT)); columnBinding = timeStepsTableBinding .addColumnBinding(ELProperty.create("${wellHasImagingType.imagingType.name}")); columnBinding.setColumnName("Imaging type"); columnBinding.setEditable(false); columnBinding.setColumnClass(String.class); columnBinding.setRenderer(new AlignedTableRenderer(SwingConstants.RIGHT)); columnBinding = timeStepsTableBinding.addColumnBinding(ELProperty.create("${timeStepSequence}")); columnBinding.setColumnName("Time sequence"); columnBinding.setEditable(false); columnBinding.setColumnClass(Integer.class); columnBinding = timeStepsTableBinding.addColumnBinding(ELProperty.create("${area}")); columnBinding.setColumnName("Area"); columnBinding.setEditable(false); columnBinding.setColumnClass(Double.class); columnBinding .setRenderer(new FormatRenderer(genericImagedPlateController.getFormat(), SwingConstants.RIGHT)); bindingGroup.addBinding(timeStepsTableBinding); bindingGroup.bind(); }
From source file:ColorPicker3.java
public GrayScalePanel() { setLayout(new GridLayout(0, 1)); // create the slider and attach us as a listener scale = new JSlider(JSlider.HORIZONTAL, 0, 255, 128); scale.addChangeListener(this); // Set up our display for the chooser add(new JLabel("Pick your shade of gray:", JLabel.CENTER)); JPanel jp = new JPanel(); jp.add(new JLabel("Black")); jp.add(scale);//www. j av a2 s . com jp.add(new JLabel("White")); add(jp); JPanel jp2 = new JPanel(); percentField = new JTextField(3); percentField.setHorizontalAlignment(SwingConstants.RIGHT); percentField.addActionListener(this); jp2.add(percentField); jp2.add(new JLabel("%")); add(jp2); }
From source file:be.ugent.maf.cellmissy.gui.controller.load.generic.singlecell.GenericSingleCellImagedPlateController.java
/** * Show Area values in table//w w w .jav a 2s .c o m */ public void showRawDataInTable() { LoadFromGenericInputPlatePanel loadFromGenericInputPlatePanel = genericImagedPlateController .getLoadFromGenericInputPlatePanel(); //table binding trackPointsTableBinding = SwingBindings.createJTableBinding(AutoBinding.UpdateStrategy.READ, trackPointsBindingList, loadFromGenericInputPlatePanel.getRawDataTable()); //add column bindings JTableBinding.ColumnBinding columnBinding = trackPointsTableBinding .addColumnBinding(ELProperty.create("${track.wellHasImagingType.well.columnNumber}")); columnBinding.setColumnName("Column"); columnBinding.setEditable(false); columnBinding.setColumnClass(Integer.class); columnBinding = trackPointsTableBinding .addColumnBinding(ELProperty.create("${track.wellHasImagingType.well.rowNumber}")); columnBinding.setColumnName("Row"); columnBinding.setEditable(false); columnBinding.setColumnClass(Integer.class); columnBinding = trackPointsTableBinding .addColumnBinding(ELProperty.create("${track.wellHasImagingType.algorithm.algorithmName}")); columnBinding.setColumnName("Algorithm"); columnBinding.setEditable(false); columnBinding.setColumnClass(String.class); columnBinding.setRenderer(new AlignedTableRenderer(SwingConstants.RIGHT)); columnBinding = trackPointsTableBinding .addColumnBinding(ELProperty.create("${track.wellHasImagingType.imagingType.name}")); columnBinding.setColumnName("Imaging type"); columnBinding.setEditable(false); columnBinding.setColumnClass(String.class); columnBinding.setRenderer(new AlignedTableRenderer(SwingConstants.RIGHT)); columnBinding = trackPointsTableBinding.addColumnBinding(ELProperty.create("${track.trackNumber}")); columnBinding.setColumnName("Track number"); columnBinding.setEditable(false); columnBinding.setColumnClass(Integer.class); columnBinding = trackPointsTableBinding.addColumnBinding(ELProperty.create("${timeIndex}")); columnBinding.setColumnName("Time index"); columnBinding.setEditable(false); columnBinding .setRenderer(new FormatRenderer(genericImagedPlateController.getFormat(), SwingConstants.RIGHT)); columnBinding = trackPointsTableBinding.addColumnBinding(ELProperty.create("${cellRow}")); columnBinding.setColumnName("x"); columnBinding.setEditable(false); columnBinding.setColumnClass(Double.class); columnBinding .setRenderer(new FormatRenderer(genericImagedPlateController.getFormat(), SwingConstants.RIGHT)); columnBinding = trackPointsTableBinding.addColumnBinding(ELProperty.create("${cellCol}")); columnBinding.setColumnName("y"); columnBinding.setEditable(false); columnBinding.setColumnClass(Double.class); columnBinding .setRenderer(new FormatRenderer(genericImagedPlateController.getFormat(), SwingConstants.RIGHT)); bindingGroup.addBinding(trackPointsTableBinding); bindingGroup.bind(); }
From source file:DesktopManagerDemo.java
public DesktopManagerDemo() { setTitle("Animated DesktopManager"); m_count = m_tencount = 0;//from w w w . j a v a2s . com JPanel innerListenerPanel = new JPanel(new GridLayout(15, 1)); JPanel listenerPanel = new JPanel(new BorderLayout()); m_dmEventCanvas = new DMEventCanvas(); m_lActivates = new JLabel("activateFrame"); m_lBegindrags = new JLabel("beginDraggingFrame"); m_lBeginresizes = new JLabel("beginResizingFrame"); m_lCloses = new JLabel("closeFrame"); m_lDeactivates = new JLabel("deactivateFrame"); m_lDeiconifies = new JLabel("deiconifyFrame"); m_lDrags = new JLabel("dragFrame"); m_lEnddrags = new JLabel("endDraggingFrame"); m_lEndresizes = new JLabel("endResizingFrame"); m_lIconifies = new JLabel("iconifyFrame"); m_lMaximizes = new JLabel("maximizeFrame"); m_lMinimizes = new JLabel("minimizeFrame"); m_lOpens = new JLabel("openFrame"); m_lResizes = new JLabel("resizeFrame"); m_lSetbounds = new JLabel("setBoundsForFrame"); innerListenerPanel.add(m_lActivates); innerListenerPanel.add(m_lBegindrags); innerListenerPanel.add(m_lBeginresizes); innerListenerPanel.add(m_lCloses); innerListenerPanel.add(m_lDeactivates); innerListenerPanel.add(m_lDeiconifies); innerListenerPanel.add(m_lDrags); innerListenerPanel.add(m_lEnddrags); innerListenerPanel.add(m_lEndresizes); innerListenerPanel.add(m_lIconifies); innerListenerPanel.add(m_lMaximizes); innerListenerPanel.add(m_lMinimizes); innerListenerPanel.add(m_lOpens); innerListenerPanel.add(m_lResizes); innerListenerPanel.add(m_lSetbounds); listenerPanel.add("Center", m_dmEventCanvas); listenerPanel.add("West", innerListenerPanel); listenerPanel.setOpaque(true); listenerPanel.setBackground(Color.white); m_myDesktopManager = new MyDesktopManager(); m_desktop = new JDesktopPane(); m_desktop.setDesktopManager(m_myDesktopManager); m_desktop.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); m_newFrame = new JButton("New Frame"); m_newFrame.addActionListener(this); m_infos = UIManager.getInstalledLookAndFeels(); String[] LAFNames = new String[m_infos.length]; for (int i = 0; i < m_infos.length; i++) { LAFNames[i] = m_infos[i].getName(); } m_UIBox = new JComboBox(LAFNames); m_UIBox.addActionListener(this); JPanel topPanel = new JPanel(true); topPanel.setLayout(new FlowLayout()); topPanel.setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new SoftBevelBorder(BevelBorder.RAISED)))); getContentPane().setLayout(new BorderLayout()); getContentPane().add("North", topPanel); getContentPane().add("Center", m_desktop); getContentPane().add("South", listenerPanel); ((JPanel) getContentPane()).setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(1, 1, 1, 1), new SoftBevelBorder(BevelBorder.RAISED)))); topPanel.add(m_newFrame); topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT)); topPanel.add(m_UIBox); setSize(645, 600); Dimension dim = getToolkit().getScreenSize(); setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2); setVisible(true); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); m_eventTimer = new Timer(1000, this); m_eventTimer.setRepeats(true); m_eventTimer.start(); }