private JInternalFrame _startJFXImpuestosCRUD() { frame = new JInternalFrame("Administrador de impuestos"); final JFXPanel fxPanel = new JFXPanel(); frame.setClosable(true); frame.add(fxPanel); frame.setVisible(true); Herramientas.panelCatalogo(frame); Principal.getEscritorio().getPanelEscritorio().add(frame); frame.setSize(706, 518); frame.setPreferredSize(new Dimension(706, 518)); frame.setResizable(true); frame.setVisible(true); Herramientas.centrarVentana(frame); Herramientas.iconificable(frame); frame.toFront(); Platform.runLater( new Runnable() { @Override public void run() { Scene scene = null; try { scene = initImpuestosCRUD(); scene.setFill(null); fxPanel.setScene(scene); } catch (IOException e) { } } }); return frame; }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFInternetDomainBaseObj focus = getSwingFocusAsDomainBase(); if (focus != null) { ICFInternetDomainBaseEditObj editObj = (ICFBamDomainBaseEditObj) focus.getEdit(); if (editObj != null) { focus = editObj; } JInternalFrame frame = null; Container cont; JDesktopPane desktop; ICFBamTenantObj referencedObj = (ICFBamTenantObj) focus.getRequiredOwnerTenant(swingIsInitializing); if (referencedObj != null) { String classCode = referencedObj.getClassCode(); if ("TENT".equals(classCode)) { frame = swingSchema.getTenantFactory().newViewEditJInternalFrame(referencedObj); cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "swingFocus", focus, "ICFBamTenantObj"); } } } }
/** * Adds a component to the middle layer of the desktop--that is, the layer for session node * editors. Note: The comp is a SessionEditor */ public void addSessionEditor(SessionEditorIndirectRef editorRef) { SessionEditor editor = (SessionEditor) editorRef; JInternalFrame frame = new TetradInternalFrame(null); frame.getContentPane().add(editor); framesMap.put(editor, frame); editor.addPropertyChangeListener(this); // Set the "small" size of the frame so that it has sensible // bounds when the users unmazimizes it. Dimension fullSize = desktopPane.getSize(); int smallSize = Math.min(fullSize.width - MARGIN, fullSize.height - MARGIN); Dimension size = new Dimension(smallSize, smallSize); setGoodBounds(frame, desktopPane, size); desktopPane.add(frame); // Set the frame to be maximized. This step must come after the frame // is added to the desktop. -Raul. 6/21/01 try { frame.setMaximum(true); } catch (Exception e) { throw new RuntimeException("Problem setting frame to max: " + frame); } desktopPane.setLayer(frame, 0); frame.moveToFront(); frame.setTitle(editor.getName()); frame.setVisible(true); setMainTitle(editor.getName()); }
public Component add(JInternalFrame frame) { JInternalFrame[] array = getAllFrames(); Point p; int w; int h; Component retval = super.add(frame); checkDesktopSize(); if (array.length > 0) { p = array[0].getLocation(); p.x = p.x + FRAME_OFFSET; p.y = p.y + FRAME_OFFSET; } else { p = new Point(0, 0); } frame.setLocation(p.x, p.y); /* Jimmy: this is a bit buggy (frames get constant size) if (frame.isResizable()) { w = getWidth() - (getWidth()/3); h = getHeight() - (getHeight()/3); if (w < frame.getMinimumSize().getWidth()) w = (int)frame.getMinimumSize().getWidth(); if (h < frame.getMinimumSize().getHeight()) h = (int)frame.getMinimumSize().getHeight(); frame.setSize(w, h); }*/ moveToFront(frame); frame.setVisible(true); try { frame.setSelected(true); } catch (PropertyVetoException e) { frame.toBack(); } return retval; }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFCrmSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFSecurityServiceTypeObj selectedInstance = getSwingFocusAsServiceType(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SVCT".equals(classCode)) { JInternalFrame frame = swingSchema.getServiceTypeFactory().newViewEditJInternalFrame(selectedInstance); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFCrmSwingServiceTypeJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit); getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFCrmServiceTypeObj"); } } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } FinderTableModel model = getDataModel(); ICFSecurityISOTimezoneObj o = (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o); ((ICFSecuritySwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); if (frame == null) { return; } Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFInternetSchemaObj schemaObj = swingSchema.getSchema(); ICFInternetMajorVersionObj obj = (ICFInternetMajorVersionObj) schemaObj.getMajorVersionTableObj().newInstance(); JInternalFrame frame = swingSchema.getMajorVersionFactory().newViewEditJInternalFrame(obj); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ICFInternetMajorVersionEditObj edit = (ICFInternetMajorVersionEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFInternetRealProjectObj container = (ICFInternetRealProjectObj) (getSwingContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SwingContainer"); } edit.setRequiredContainerParent(container); ICFInternetSwingMajorVersionJPanelCommon jpanelCommon = (ICFInternetSwingMajorVersionJPanelCommon) frame; jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFAccSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFSecurityServiceObj selectedInstance = getSwingFocusAsService(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("HSVC".equals(classCode)) { JInternalFrame frame = swingSchema.getServiceFactory().newAskDeleteJInternalFrame(selectedInstance); ((ICFAccSwingServiceJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); frame.addInternalFrameListener(getViewEditInternalFrameListener()); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFAccServiceObj"); } } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFBamSchemaObj schemaObj = swingSchema.getSchema(); ICFBamAuditActionObj obj = (ICFBamAuditActionObj) schemaObj.getAuditActionTableObj().newInstance(); JInternalFrame frame = swingSchema.getAuditActionFactory().newViewEditJInternalFrame(obj); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ICFBamAuditActionEditObj edit = (ICFBamAuditActionEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFBamSwingAuditActionJPanelCommon jpanelCommon = (ICFBamSwingAuditActionJPanelCommon) frame; jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFSecuritySchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFSecurityHostNodeObj obj = (ICFSecurityHostNodeObj) schemaObj.getHostNodeTableObj().newInstance(); ICFSecurityHostNodeEditObj edit = (ICFSecurityHostNodeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityClusterObj secCluster = schemaObj.getSecCluster(); edit.setRequiredContainerCluster(secCluster); JInternalFrame frame = swingSchema.getHostNodeFactory().newViewEditJInternalFrame(obj); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ICFSecuritySwingHostNodeJPanelCommon jpanelCommon = (ICFSecuritySwingHostNodeJPanelCommon) frame; jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add); getDesktopPane().add(frame); frame.setVisible(true); frame.show(); }
/** * Reacts to property change events 'editorClosing', 'closeFrame', and 'name'. * * @param e the property change event. */ public void propertyChange(PropertyChangeEvent e) { // Handles the removal of editor frames from desktop String name = e.getPropertyName(); if ("editorClosing".equals(name)) { // find NewValue in String array, and remove for (int n = 0; n < sessionNodeKeys.size(); n++) { if (e.getNewValue().equals((sessionNodeKeys.get(n)))) { sessionNodeKeys.remove(n); } } } else if ("closeFrame".equals(e.getPropertyName())) { if (getFramesMap().containsKey(e.getSource())) { Object frameObject = getFramesMap().get(e.getSource()); JInternalFrame frame = (JInternalFrame) frameObject; frame.setVisible(false); frame.dispose(); } } else if ("name".equals(e.getPropertyName())) { if (getFramesMap().containsKey(e.getSource())) { Object frameObject = getFramesMap().get(e.getSource()); JInternalFrame frame = (JInternalFrame) frameObject; String _name = (String) (e.getNewValue()); frame.setTitle(_name); setMainTitle(_name); } } }
public void disposeCurrentFrame() { if (currentFrame != null) { lastLocation = currentFrame.getLocation(); currentFrame.setVisible(false); currentFrame.dispose(); currentFrame = null; } }
public void openHelpWindow() { JInternalFrame help = new MetalworksHelp(); desktop.add(help, HELPLAYER); try { help.setVisible(true); help.setSelected(true); } catch (java.beans.PropertyVetoException e2) { } }
public void openInBox() { JInternalFrame doc = new MetalworksInBox(); desktop.add(doc, DOCLAYER); try { doc.setVisible(true); doc.setSelected(true); } catch (java.beans.PropertyVetoException e2) { } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } ListTableModel model = getDataModel(); ICFInternetVersionObj o = (ICFInternetVersionObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = null; String classCode = o.getClassCode(); if (classCode.equals("VERN")) { frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else if (classCode.equals("MJVR")) { frame = swingSchema .getMajorVersionFactory() .newViewEditJInternalFrame((ICFInternetMajorVersionObj) o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else if (classCode.equals("MNVR")) { frame = swingSchema .getMinorVersionFactory() .newViewEditJInternalFrame((ICFInternetMinorVersionObj) o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else { frame = null; } if (frame == null) { return; } Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public MapEditor(LocalSettings localSettings) throws HeadlessException { setTitle(TITLE); setSize(WIDTH, HEIGHT); this.localSettings = localSettings; mainpane = new JDesktopPane(); mainpane.setSize(WIDTH, HEIGHT); mainpane.setBackground(Color.GRAY); setContentPane(mainpane); LwjglApplicationConfiguration configuration = new LwjglApplicationConfiguration(); configuration.width = WIDTH; configuration.height = HEIGHT; levelHolder = new LevelHolder(); final LwjglCanvas lwjglCanvas = new LwjglCanvas(levelHolder, configuration); canvas = lwjglCanvas; levelHolderFrame = new JInternalFrame("EnJine2D Map", false, false, false, true); levelHolderFrame.setSize(WIDTH, HEIGHT); levelHolderFrame.setVisible(true); palette = new Palette("Palette", true, false, true, true); palette.setVisible(true); palette.setLevelHolder(levelHolder); levelHolder.setPalette(palette); getContentPane().add(palette); getContentPane().add(levelHolderFrame); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { levelHolderFrame.getContentPane().add(lwjglCanvas.getCanvas()); setVisible(true); } }); loadSettings(); levelHolderFrame.addComponentListener(this); palette.addComponentListener(this); addWindowListener(this); }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; if (getSwingFocusAsUInt64Col() != null) { if (null == getSwingFocusAsUInt64Col().getEdit()) { JInternalFrame frame = swingSchema .getUInt64ColFactory() .newAskDeleteJInternalFrame(getSwingFocusAsUInt64Col()); ((ICFDbTestSwingUInt64ColJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot begin deletion of an object already edited by another window instance"); } } }
private void handleSpecialCase(String cname, int condition) { Component comp = null; JComponent mapComp = null; try { if (cname.equals("javax.swing.JApplet") || cname.equals("javax.swing.JDialog") || cname.equals("javax.swing.JFrame") || cname.equals("javax.swing.JWindow")) { comp = (Component) Class.forName(cname).newInstance(); mapComp = (JComponent) ((JApplet) comp).getLayeredPane(); results.setText("Map entries for " + cname + " (delegated to JRootPane):\n\n"); } else if (cname.equals("javax.swing.JInternalFrame")) { JDesktopPane jdp = new JDesktopPane(); JInternalFrame jif = new JInternalFrame("Demo"); jif.setVisible(true); jdp.add(jif); mapComp = jif; } if (inputB.isSelected()) { loadInputMap(mapComp.getInputMap(condition), ""); results.append("\n"); } if (actionB.isSelected()) { loadActionMap(mapComp.getActionMap(), ""); results.append("\n"); } if (bindingB.isSelected()) { loadBindingMap(mapComp, condition); } } catch (ClassCastException cce) { results.setText(cname + " is not a subclass of JComponent."); } catch (ClassNotFoundException cnfe) { results.setText(cname + " was not found."); } catch (InstantiationException ie) { results.setText(cname + " could not be instantiated."); } catch (Exception e) { results.setText("Exception found:\n" + e); e.printStackTrace(); } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFCrmSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFCrmServiceTypeObj obj = (ICFCrmServiceTypeObj) schemaObj.getServiceTypeTableObj().newInstance(); ICFCrmServiceTypeEditObj edit = (ICFCrmServiceTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } JInternalFrame frame = swingSchema.getServiceTypeFactory().newViewEditJInternalFrame(obj); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ICFCrmSwingServiceTypeJPanelCommon jpanelCommon = (ICFCrmSwingServiceTypeJPanelCommon) frame; jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add); getDesktopPane().add(frame); frame.setVisible(true); frame.show(); }
/** Adds the given componet to the given layer. */ public void addEditorWindow(EditorWindowIndirectRef windowRef) { final JInternalFrame window = (JInternalFrame) windowRef; Dimension desktopSize = desktopPane.getSize(); Dimension preferredSize = window.getPreferredSize(); int x = desktopSize.width / 2 - preferredSize.width / 2; int y = desktopSize.height / 2 - preferredSize.height / 2; window.setBounds(x, y, preferredSize.width, preferredSize.height); // This line sometimes hangs, so I'm putting it in a watch process // so it can be stopped by the user. Not ideal. // Window owner = (Window) getTopLevelAncestor(); // // new WatchedProcess(owner) { // public void watch() { getDesktopPane().add(window); window.setLayer(100); window.moveToFront(); try { window.setVisible(true); } catch (Exception e) { if (e instanceof ClassCastException || e instanceof NullPointerException) { // skip. These is being caused apparently the workbench // having labeled nodes and edges. Can't find a // workaround--probably a Java bug. jdramsey } else { e.printStackTrace(); } } // prevents the component from being hidden. // window.addComponentListener(new PositionListener()); // } // }; }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; Container cont; JDesktopPane desktop; ICFDbTestSchemaObj schemaObj = swingSchema.getSchema(); ICFSecurityTSecGroupObj focus = getSwingFocusAsTSecGroup(); ICFSecurityTSecGroupEditObj editObj = (ICFSecurityTSecGroupEditObj) focus.getEdit(); if (editObj != null) { focus = editObj; } ICFDbTestTenantObj referencedObj = (ICFDbTestTenantObj) focus.getRequiredContainerTenant(swingIsInitializing); java.util.List<ICFSecurityTenantObj> listOfTenant = null; CFSecurityAuthorization auth = schemaObj.getAuthorization(); long containingClusterId = auth.getSecClusterId(); listOfTenant = schemaObj.getTenantTableObj().readTenantByClusterIdx(containingClusterId); if (listOfTenant == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "listOfTenant"); } Collection<ICFSecurityTenantObj> cltn = listOfTenant; JInternalFrame frame = swingSchema .getTenantFactory() .newPickerJInternalFrame( referencedObj, null, cltn, new CallbackTSecGroupTenantChosen()); ((ICFDbTestSwingTenantJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; Container cont; JDesktopPane desktop; ICFDbTestSchemaObj schemaObj = swingSchema.getSchema(); ICFSecuritySecSessionObj focus = getSwingFocusAsSecSession(); ICFSecuritySecSessionEditObj editObj = (ICFSecuritySecSessionEditObj) focus.getEdit(); if (editObj != null) { focus = editObj; } ICFDbTestSecUserObj referencedObj = (ICFDbTestSecUserObj) focus.getRequiredParentSecProxy(swingIsInitializing); java.util.List<ICFSecuritySecUserObj> listOfSecUser = null; listOfSecUser = schemaObj.getSecUserTableObj().readAllSecUser(); if (listOfSecUser == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "listOfSecUser"); } Collection<ICFSecuritySecUserObj> cltn = listOfSecUser; JInternalFrame frame = swingSchema .getSecUserFactory() .newPickerJInternalFrame( referencedObj, null, cltn, new CallbackSecSessionProxyChosen()); ((ICFDbTestSwingSecUserJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public JunctionLinkDataFrame(final JunctionLink jl) { super( jl.getCurrName() + " properties", false, // resizable false, // closable false, // maximizable true); // iconifiable // PSRender.onHold(); super.setBackground(back_color); super.addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameActivated(InternalFrameEvent e) { reload(); SelectedObject.setSelectedObject(jl); } }); PSRender.moveToTop(jl.getBound(), 0.5); ml = jl; setLocation(50, 50); dataModelMain = new HeadTable(jl); tableMain = new JTable(dataModelMain); tableMain.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN); tableMain.setPreferredScrollableViewportSize(new Dimension(500, 20)); // tableMain.setBackground(back_color); // code TableColumn column_code = tableMain.getColumn("Code"); DefaultTableCellRenderer rendererCode = new DefaultTableCellRenderer(); rendererCode.setToolTipText("Enter new code for this path"); column_code.setCellRenderer(rendererCode); column_code.setCellEditor(new TextFieldEditor()); // name TableColumn column_name = tableMain.getColumn("Name"); LanguageButtonRender render_name = new LanguageButtonRender(); render_name.setToolTipText("Path name. Press for change name"); column_name.setCellRenderer(render_name); LanguageButtonEditor editor_name = new LanguageButtonEditor(new JCheckBox()); column_name.setCellEditor(editor_name); // junction 1 TableColumn column_junc_1 = tableMain.getColumn("Junction 1"); MLButtonRenderer rendererJunc_1 = new MLButtonRenderer(); rendererJunc_1.setToolTipText("Code of first Junction, click for open properties"); column_junc_1.setCellRenderer(rendererJunc_1); MLButtonEditor editorJunc = new MLButtonEditor(new JCheckBox()); column_junc_1.setCellEditor(editorJunc); // junction 2 TableColumn column_junc_2 = tableMain.getColumn("Junction 2"); MLButtonRenderer rendererJunc_2 = new MLButtonRenderer(); rendererJunc_2.setToolTipText("Code of second Junction, click for open properties"); column_junc_2.setCellRenderer(rendererJunc_2); column_junc_2.setCellEditor(editorJunc); // type JComboBox comboBoxType = new JComboBox(); String roadNames[] = jl.getTypeNames(); for (int i = 0, len = roadNames.length; i < len; i++) { comboBoxType.addItem(roadNames[i]); } TableColumn column_type = tableMain.getColumn("Type"); DefaultTableCellRenderer rendererType = new DefaultTableCellRenderer(); rendererType.setToolTipText("To change road type click for combo box"); column_type.setCellRenderer(rendererType); column_type.setCellEditor(new DefaultCellEditor(comboBoxType)); // legth TableColumn column_length = tableMain.getColumn("Length"); DefaultTableCellRenderer rendererLen = new DefaultTableCellRenderer(); rendererLen.setToolTipText("The path length in meters"); column_length.setCellRenderer(rendererLen); scrollpaneMain = new JScrollPane(tableMain); scrollpaneMain.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollpaneMain.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); scrollpaneMain.setPreferredSize(new Dimension(500, 50)); Container contentPane = super.getContentPane(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); contentPane.setLayout(gridbag); c.ipady = 0; // make this component tall c.weightx = 0.5; c.gridwidth = 4; c.gridx = 0; c.gridy = 0; gridbag.setConstraints(scrollpaneMain, c); // scrollpaneMain.setBackground(back_color); // scrollpaneMain.setForeground(back_color); contentPane.add(scrollpaneMain); TableModel dataModelPoints = new PointTableModel(jl); tablePoints = new JTable(dataModelPoints); tablePoints.setPreferredScrollableViewportSize( new Dimension(200, dataModelPoints.getRowCount() * tablePoints.getRowHeight())); ListModel lm = new AbstractListModel() { public int getSize() { return 1000; } public Object getElementAt(int index) { return "" + index; } }; JList rowHeader = new JList(lm); rowHeader.setFixedCellWidth(20); rowHeader.setFixedCellHeight(tablePoints.getRowHeight()); // + tablePoints.getRowMargin()); rowHeader.setCellRenderer(new RowHeaderRenderer(tablePoints)); scrollPanePoints = new JScrollPane(tablePoints); scrollPanePoints.setWheelScrollingEnabled(true); scrollPanePoints.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPanePoints.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); int mh; if (dataModelPoints.getRowCount() * tablePoints.getRowHeight() > 100) { mh = 100; } else { mh = dataModelPoints.getRowCount() * tablePoints.getRowHeight(); } scrollPanePoints.setPreferredSize(new Dimension(200, mh)); scrollPanePoints.setRowHeaderView(rowHeader); c.ipadx = 200; c.weightx = 0.5; c.gridwidth = 3; c.gridx = 1; c.gridy = 1; gridbag.setConstraints(scrollPanePoints, c); // scrollPanePoints.setBackground(back_color); contentPane.add(scrollPanePoints); button_ok = new JButton("Ok"); button_ok.addActionListener(this); JPanel buttonPane = new JPanel(null); buttonPane.setPreferredSize(new Dimension(500, 100)); button_ok.setBounds(205, 40, 90, 40); buttonPane.add(button_ok); c.ipady = 10; // make this component tall c.ipadx = 10; c.weightx = 0.5; c.gridwidth = 4; c.gridx = 2; c.gridy = 2; gridbag.setConstraints(buttonPane, c); buttonPane.setBackground(back_color); contentPane.add(buttonPane); super.pack(); super.setVisible(true); // MapApplication.getDesktop().setSelectedFrame(this); }
/** * Method to handle hyper link events. * * @param event hyper link event */ public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { setCursor(cbusy); try { URL url = event.getURL(); int ind1 = event.getDescription().indexOf("["); int ind2 = event.getDescription().lastIndexOf("]"); String search = ""; if (ind1 > -1 && ind2 > -1) search = event.getDescription().substring(ind1 + 1, ind2); else { ind1 = event.getDescription().indexOf("=") + 1; // genedb if (ind1 > -1) search = event.getDescription().substring(ind1); } if (desktop != null) { if (BigPane.srsTabPane.isSelected()) setUpSRSFrame(url, search); if (BigPane.srsWin.isSelected()) { int hgt = (2 * desktop.getHeight()) / 3; Annotation edPane = new Annotation(url); JScrollPane jsp = new JScrollPane(edPane); JInternalFrame jif = new JInternalFrame( "SRS " + search, true, // resizable true, // closable true, // maximizable true); // iconifiable); JMenuBar menuBar = new JMenuBar(); menuBar.add(new CommonMenu(jif)); jif.setJMenuBar(menuBar); jif.getContentPane().add(jsp); jif.setLocation(0, 0); jif.setSize(800, hgt); jif.setVisible(true); desktop.add(jif); } if (BigPane.srsBrowser.isSelected()) BrowserControl.displayURL(event.getDescription()); } else { setPage(url); back.add(url); } } catch (IOException ioe) { String msg = event.getDescription(); if (msg.length() > 50) msg = msg.substring(0, 50) + "...."; JOptionPane.showMessageDialog( this, "Cannot reach URL:\n" + msg, "Cannot Connect", JOptionPane.INFORMATION_MESSAGE); // ioe.printStackTrace(); // ("Can't follow link to " + // event.getURL().toExternalForm() ); } setCursor(cdone); } else if (event.getEventType() == HyperlinkEvent.EventType.ENTERED) { try { JTextField statusField = (JTextField) BigPane.srsFrame.getContentPane().getComponent(1); statusField.setText(event.getDescription()); } catch (Exception exp) { } } else if (event.getEventType() == HyperlinkEvent.EventType.EXITED) { try { JTextField statusField = (JTextField) BigPane.srsFrame.getContentPane().getComponent(1); statusField.setText(""); } catch (Exception exp) { } } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; CFBamSwingMainJFrame mainJFrame = null; { Container cont = getParent(); while ((cont != null) && (!(cont instanceof CFBamSwingMainJFrame))) { cont = cont.getParent(); } if (cont != null) { mainJFrame = (CFBamSwingMainJFrame) cont; } } char pw[] = textKeystorePassword.getPassword(); String keystorePassword; if (pw != null) { keystorePassword = new String(pw); } else { keystorePassword = null; } CFBamClientConfigurationFile configFile = swingSchema.getClientConfigurationFile(); String keystoreFileName = configFile.getKeyStore(); boolean exitApp = false; boolean exitForm = false; boolean creatingKeystore = false; KeyStore keyStore = null; File keystoreFile = new File(keystoreFileName); if (!keystoreFile.exists()) { int userOption = JOptionPane.NO_OPTION; try { userOption = JOptionPane.showOptionDialog( null, "Would you like to create the keystore \"" + keystoreFileName + "\"?\n" + "Selecting No will exit the application so you can edit the client configuration file and restart.", "Create Keystore?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); } catch (HeadlessException x) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught HeadlessException -- " + x.getMessage(), x); } if (userOption == JOptionPane.YES_OPTION) { creatingKeystore = true; JInternalFrame nextForm = swingSchema.newCreateKeystoreJInternalFrame(); getDesktopPane().add(nextForm); nextForm.setVisible(true); nextForm.show(); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame frame = (JInternalFrame) cont; try { frame.setClosed(true); } catch (Exception x) { } } } else { exitApp = true; } } else if (!keystoreFile.isFile()) { JOptionPane.showMessageDialog( null, "The referenced JCEKS keystore \"" + keystoreFileName + "\" is not a file.", "Error", JOptionPane.ERROR_MESSAGE, null); exitApp = true; } else if (!keystoreFile.canRead()) { JOptionPane.showMessageDialog( null, "Permission denied attempting to access JCEKS keystore \"" + keystoreFileName + "\".", "Error", JOptionPane.ERROR_MESSAGE, null); exitApp = true; } if ((!exitApp) && (!creatingKeystore)) { try { keyStore = KeyStore.getInstance("jceks"); char[] caPassword = keystorePassword.toCharArray(); FileInputStream input = new FileInputStream(keystoreFileName); keyStore.load(input, caPassword); input.close(); swingSchema.setKeyStore(keyStore); exitForm = true; } catch (CertificateException x) { keyStore = null; JOptionPane.showMessageDialog( null, "Could not open keystore due to CertificateException -- " + x.getMessage(), "Error", JOptionPane.ERROR_MESSAGE, null); exitApp = true; } catch (IOException x) { keyStore = null; JOptionPane.showMessageDialog( null, "Could not open keystore due to IOException -- " + x.getMessage(), "Error", JOptionPane.ERROR_MESSAGE, null); } catch (KeyStoreException x) { keyStore = null; JOptionPane.showMessageDialog( null, "Could not open keystore due to KeyStoreException -- " + x.getMessage(), "Error", JOptionPane.ERROR_MESSAGE, null); exitApp = true; } catch (NoSuchAlgorithmException x) { keyStore = null; JOptionPane.showMessageDialog( null, "Could not open keystore due to NoSuchAlgorithmException -- " + x.getMessage(), "Error", JOptionPane.ERROR_MESSAGE, null); exitApp = true; } } if (exitApp) { swingSchema.setKeyStore(null); mainJFrame.exitApplication(); } else if (exitForm) { JInternalFrame nextForm = swingSchema.newOpenDeviceKeyJInternalFrame(); getDesktopPane().add(nextForm); nextForm.setVisible(true); nextForm.show(); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame frame = (JInternalFrame) cont; try { frame.setClosed(true); } catch (Exception x) { } } } }
/** The graphic handling and deployment. */ private void initComponents() { jDesktopPane1 = new javax.swing.JDesktopPane(); jInternalFrame1 = new javax.swing.JInternalFrame(); tf = new javax.swing.JTextField(); b1 = new javax.swing.JButton(); jInternalFrame3 = new javax.swing.JInternalFrame(); ta = new javax.swing.JTextArea(); jsp_ta = new javax.swing.JScrollPane(ta); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); jMenuItem4 = new javax.swing.JMenuItem(); jInternalFrame1 .getContentPane() .setLayout( new javax.swing.BoxLayout( jInternalFrame1.getContentPane(), javax.swing.BoxLayout.X_AXIS)); jInternalFrame1.setIconifiable(true); jInternalFrame1.setMaximizable(true); jInternalFrame1.setResizable(true); jInternalFrame1.setTitle("Message editor"); jInternalFrame1.setToolTipText( "Move and resize all of these to make the chat room appearance match your preferences."); jInternalFrame1.setVisible(true); tf.setFont(new java.awt.Font("Lucida Sans", 0, 12)); jInternalFrame1.getContentPane().add(tf); b1.setText("Send Message"); jInternalFrame1.getContentPane().add(b1); jInternalFrame1.setBounds(10, 10, 440, 60); jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER); jInternalFrame3.setIconifiable(true); jInternalFrame3.setMaximizable(true); jInternalFrame3.setResizable(true); jInternalFrame3.setTitle("Messages"); jInternalFrame3.setToolTipText( "Move and resize all of these to make the chat room appearance match your preferences."); jInternalFrame3.setVisible(true); ta.setBackground(new Color(255, 255, 255)); ta.setEditable(false); ta.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // jsp_ta.setAutoscrolls(true); jsp_ta.setDoubleBuffered(true); jInternalFrame3.getContentPane().add(jsp_ta, java.awt.BorderLayout.CENTER); jInternalFrame3.setBounds(10, 80, 420, 240); jDesktopPane1.add(jInternalFrame3, javax.swing.JLayeredPane.DEFAULT_LAYER); getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER); jMenu1.setText("Private room options"); jMenu1.setMnemonic(KeyEvent.VK_O); jMenu1.setToolTipText("Choose some options."); jMenuItem3.setText("Save conversation"); jMenuItem3.setMnemonic(KeyEvent.VK_S); jMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); jMenu1.add(jMenuItem3); jMenu1.add(jSeparator1); jMenuItem4.setText("Exit"); jMenuItem4.setMnemonic(KeyEvent.VK_E); jMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK)); jMenu1.add(jMenuItem4); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); this.pack(); b1.addActionListener(this); tf.addActionListener(this); jMenuItem3.addActionListener(this); jMenuItem4.addActionListener(this); posx = (int) Math.random() * 640; posy = (int) Math.random() * 480; this.pack(); this.setSize(dimx, dimy); this.setLocation(posx, posy); this.show(); }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFInternetSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFInternetVersionObj selectedInstance = getSwingFocusAsVersion(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("VERN".equals(classCode)) { JInternalFrame frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(selectedInstance); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } } else if ("MJVR".equals(classCode)) { ICFInternetMajorVersionObj obj = (ICFInternetMajorVersionObj) selectedInstance; JInternalFrame frame = swingSchema.getMajorVersionFactory().newViewEditJInternalFrame(obj); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } } else if ("MNVR".equals(classCode)) { ICFInternetMinorVersionObj obj = (ICFInternetMinorVersionObj) selectedInstance; JInternalFrame frame = swingSchema.getMinorVersionFactory().newViewEditJInternalFrame(obj); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit); Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFInternetVersionObj, ICFInternetMajorVersionObj, ICFInternetMinorVersionObj"); } } }