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 init() { // 向内部窗口中添加组件 iframe.add(new JScrollPane(new JTextArea(8, 40))); desktop.setPreferredSize(new Dimension(400, 300)); // 把虚拟桌面添加到JFrame窗口中 jf.add(desktop); // 设置内部窗口的大小、位置 iframe.reshape(0, 0, 300, 200); // 显示并选中内部窗口 iframe.show(); desktop.add(iframe); JPanel jp = new JPanel(); deskBn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { // 弹出内部对话框,以虚拟桌面作为父组件 JOptionPane.showInternalMessageDialog(desktop, "属于虚拟桌面的对话框"); } }); internalBn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { // 弹出内部对话框,以内部窗口作为父组件 JOptionPane.showInternalMessageDialog(iframe, "属于内部窗口的对话框"); } }); jp.add(deskBn); jp.add(internalBn); jf.add(jp, BorderLayout.SOUTH); jf.pack(); jf.setVisible(true); }
public void run(TaskMonitor monitor, PlugInContext context) throws Exception { // -- get the LM because when the Histogram will be shown, the app. focus // will change and context.addLayer will not work (null pointer exc.) // [mmichaud 2012-04-09] to completely resolve this problem, I added the // new JInternalFrame is added after the addLayer method has been called this.currentLM = context.getLayerManager(); monitor.allowCancellationRequests(); if (this.selAttribute == null) { context.getWorkbenchFrame().warnUser(I18N.get(sNoAttributeChoosen)); return; } javax.swing.JInternalFrame internalFrame = context.getWorkbenchFrame().getActiveInternalFrame(); FeatureDataset result = classifyAndCreatePlot(monitor, context); context.getWorkbenchFrame().activateFrame(internalFrame); if (result == null) { context.getWorkbenchFrame().warnUser(I18N.get(sNotEnoughValuesWarning)); } else if (result.size() > 0) { String name = this.selAttribute + "_" + this.selClassifier; this.currentLM.addLayer(StandardCategoryNames.WORKING, name, result); JInternalFrame frame = new JInternalFrame(this.sHistogram); frame.setLayout(new BorderLayout()); frame.add(plot, BorderLayout.CENTER); frame.setClosable(true); frame.setResizable(true); frame.setMaximizable(true); frame.setSize(450, 450); context.getWorkbenchFrame().addInternalFrame(frame); plot = null; } else { context.getWorkbenchFrame().warnUser(sWarning); } }
private void initAboutFrames() { System.out.println("Initializing the about frames..."); authorFrame = new JInternalFrame("Authors", true, true, true, true); problemFrame = new JInternalFrame("Problem Description", true, true, true, true); final String AUTHOR_TEXT = "Authors:\n Ethan Wells and San Yeung\n"; JTextArea authorFrameTextArea = new JTextArea(AUTHOR_TEXT); authorFrameTextArea.setEditable(false); authorFrameTextArea.setLineWrap(true); authorFrameTextArea.setColumns(60); authorFrame.add(authorFrameTextArea); authorFrame.pack(); final String PROBLEM_TEXT = "Two towns A and B are connected with a bridge. Suppose there are four\n" + "people and their moving directions are indicated by the arrows. The bridge is narrow, and at any\n" + "time, multiple people cannot pass in the opposite directions.\n" + "1. Based on the Ricart & Agrawalas mutual exclusion algorithm, design a decentralized protocol\n" + "so that at most one person can be on the bridge at any given time, and no person is indefinitely\n" + "prevented from crossing the bridge. Treat each person to be a process, and assume that their\n" + "clocks are synchronized.\n" + "2. Design another protocol so that multiple people can be on the bridge as long as they are\n" + "moving in the same direction, but no person is indefinitely prevented from crossing the bridge.\n" + "Design a graphical user interface to display the movement of the people, so that the instructor can\n" + "control the walking speed of the people and verify the protocol. Note that to receive full credits,\n" + "you should provide instructions on how to compile and run your program, and your program should\n" + "be well-documented."; JTextArea problemFrameTextArea = new JTextArea(PROBLEM_TEXT); problemFrameTextArea.setEditable(false); problemFrameTextArea.setLineWrap(true); problemFrameTextArea.setColumns(70); problemFrame.add(problemFrameTextArea); problemFrame.pack(); authorFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); problemFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); virtualDesktop.add(authorFrame); virtualDesktop.add(problemFrame); }
public JInternalFrame employeeFrame() { JInternalFrame f = new JInternalFrame(); f = new JInternalFrame( "Employee Database", false, // Resizable true, // Closable true, // Maximizable true); // Iconifiable f.setLayout(new BorderLayout()); JScrollPane sp = new JScrollPane(employeeTable()); sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setBorder(BorderFactory.createTitledBorder("Employees")); f.add(buttonPanel(false), BorderLayout.NORTH); f.add(sp); // f.setLocation(loc); f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); f.setFrameIcon(images.loadImage("Images/menubar/database_icon.png")); f.addInternalFrameListener(this); if (osp.isLowResolution()) f.setSize(550, 282); else if (osp.isMidResolution()) f.setSize(550, 282); else f.setSize(850, 500); // Width, Height f.setVisible(true); try { f.setSelected(true); } catch (PropertyVetoException e1) { e1.printStackTrace(); } return f; }
/** Builds the bottom Addresses Frame */ private void createAddressesInternalFrame() { { jPanelAddresses = new JPanel(); jPanelAddresses.setLayout(new BorderLayout()); { jScrollPaneAddresses = new JScrollPane(); { refillAddressView(); } jPanelAddresses.add(jScrollPaneAddresses, BorderLayout.CENTER); jScrollPaneAddresses.setPreferredSize(new java.awt.Dimension(830, 226)); jScrollPaneAddresses.setBorder( new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); jScrollPaneAddresses.setAutoscrolls(true); } { final JPanel buttonPanel = new JPanel(); jPanelAddresses.add(buttonPanel, BorderLayout.SOUTH); buttonPanel.setPreferredSize(new java.awt.Dimension(830, 35)); { jButtonAddressNew = new JButton(); buttonPanel.add(jButtonAddressNew); jButtonAddressNew.setText("Nieuw"); jButtonAddressNew.setToolTipText("Nieuw adres"); enableAddressButton(); jButtonAddressNew.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent evt) { new JDialogAddress(customer, null, CRUDOperationEnum.NEW); refillAddressView(); } }); } } jInternalFrameCustomerAddresses = new JInternalFrame("Adressen"); jInternalFrameCustomerAddresses.add(jPanelAddresses); jPanelAddresses.setPreferredSize(new java.awt.Dimension(830, 236)); jInternalFrameCustomerAddresses.setVisible(true); jInternalFrameCustomerAddresses.setBounds(1, 427, 840, 227); jInternalFrameCustomerAddresses.setPreferredSize(new java.awt.Dimension(840, 227)); } }
/** Builds the right contacts frame */ private void createContactsInternalFrame() { { jPanelCustomerContacts = new JPanel(); jPanelCustomerContacts.setLayout(new BorderLayout()); { jScrollPaneContacts = new JScrollPane(); { refillContactsView(); } jPanelCustomerContacts.add(jScrollPaneContacts, BorderLayout.CENTER); jScrollPaneContacts.setPreferredSize(new java.awt.Dimension(415, 314)); jScrollPaneContacts.getHorizontalScrollBar().setAutoscrolls(true); jScrollPaneContacts.getVerticalScrollBar().setAutoscrolls(true); jScrollPaneContacts.setAutoscrolls(true); jScrollPaneContacts.setBorder( new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); } { final JPanel buttonPanel = new JPanel(); jPanelCustomerContacts.add(buttonPanel, BorderLayout.SOUTH); { jButtonContactNew = new JButton("Nieuw"); buttonPanel.add(jButtonContactNew); jButtonContactNew.setToolTipText("Nieuw contact"); enableContactButton(); jButtonContactNew.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent evt) { new JDialogContact(customer, null, CRUDOperationEnum.NEW); refillContactsView(); } }); } } jInternalFrameCustomerContacts = new JInternalFrame("Contacten"); jInternalFrameCustomerContacts.add(jPanelCustomerContacts); jInternalFrameCustomerContacts.setVisible(true); jInternalFrameCustomerContacts.setBounds(388, 1, 443, 339); jInternalFrameCustomerContacts.setPreferredSize(new java.awt.Dimension(443, 339)); } }
public static JComponent createContent() { JDesktopPane desktopPane = new JDesktopPane(); // Web Browser 1 internal frame JInternalFrame webBrowser1InternalFrame = new JInternalFrame("Web Browser 1"); webBrowser1InternalFrame.setBounds(10, 10, 400, 280); webBrowser1InternalFrame.setResizable(true); webBrowser1InternalFrame.setVisible(true); JWebBrowser webBrowser1 = new JWebBrowser(JWebBrowser.proxyComponentHierarchy()); webBrowser1.navigate("http://djproject.sf.net"); webBrowser1InternalFrame.add(webBrowser1, BorderLayout.CENTER); desktopPane.add(webBrowser1InternalFrame); // Flash Player internal frame JInternalFrame flashPlayerInternalFrame = new JInternalFrame("Flash Player"); flashPlayerInternalFrame.setBounds(100, 100, 400, 280); flashPlayerInternalFrame.setResizable(true); flashPlayerInternalFrame.setVisible(true); JFlashPlayer flashPlayer = new JFlashPlayer(JFlashPlayer.proxyComponentHierarchy()); flashPlayer.setControlBarVisible(false); flashPlayer.load(SimpleFlashExample.class, "resource/Movement-pointer_or_click.swf"); flashPlayerInternalFrame.add(flashPlayer, BorderLayout.CENTER); desktopPane.add(flashPlayerInternalFrame); // Web Browser 2 internal frame, with a button on top JInternalFrame webBrowser2InternalFrame = new JInternalFrame("Web Browser 2 with a JButton on top"); webBrowser2InternalFrame.setBounds(190, 190, 400, 280); webBrowser2InternalFrame.setResizable(true); webBrowser2InternalFrame.setVisible(true); GridBagLayout gridBag = new GridBagLayout(); GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.BOTH; cons.gridx = 0; cons.gridy = 0; JPanel webBrowser2ContentPane = new JPanel(gridBag) { @Override public boolean isOptimizedDrawingEnabled() { return false; } }; // When a frame is iconified, components are destroyed. To avoid this, we use the option to // destroy on finalization. final JWebBrowser webBrowser2 = new JWebBrowser(JWebBrowser.proxyComponentHierarchy(), JWebBrowser.destroyOnFinalization()); webBrowser2.navigate("http://www.google.com"); cons.weightx = 1; cons.weighty = 1; gridBag.setConstraints(webBrowser2, cons); webBrowser2ContentPane.add(webBrowser2); JButton webBrowser2Button = new JButton("A Swing button"); cons.fill = GridBagConstraints.NONE; cons.weightx = 0; cons.weighty = 0; gridBag.setConstraints(webBrowser2Button, cons); webBrowser2ContentPane.add(webBrowser2Button); webBrowser2ContentPane.setComponentZOrder(webBrowser2Button, 0); webBrowser2InternalFrame.add(webBrowser2ContentPane, BorderLayout.CENTER); webBrowser2InternalFrame.setIconifiable(true); desktopPane.add(webBrowser2InternalFrame); JPanel contentPane = new JPanel(new BorderLayout()) { @Override public void removeNotify() { super.removeNotify(); // webBrowser2 is destroyed on finalization. // Rather than wait for garbage collection, release when the component is removed from // its parent. webBrowser2.disposeNativePeer(); } }; contentPane.add(desktopPane, BorderLayout.CENTER); return contentPane; }