List of usage examples for javax.swing JDesktopPane add
public Component add(Component comp)
From source file:org.jfree.chart.demo.InternalFrameDemo.java
/** * Creates a new instance of the demo.// w ww . ja va 2s .co m * * @param title the title. */ public InternalFrameDemo(final String title) { super(title); final JDesktopPane desktopPane = new JDesktopPane(); desktopPane.setPreferredSize(new Dimension(600, 400)); final JInternalFrame frame1 = createFrame1(); desktopPane.add(frame1); frame1.pack(); frame1.setVisible(true); final JInternalFrame frame2 = createFrame2(); desktopPane.add(frame2); frame2.pack(); frame2.setLocation(100, 200); frame2.setVisible(true); getContentPane().add(desktopPane); }
From source file:com.emr.schemas.SchemerMapper.java
/** * Handles click event for the Next button * Opens {@link TableRelationsForm} for the user to define the relationships between the selected tables. * @param evt {@link ActionEvent}/*from w w w . j a v a 2 s . c o m*/ */ private void btnNextScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextScreenActionPerformed if (listOfTables.isEmpty()) { JOptionPane.showMessageDialog(this, "Please select source tables from thee list", "No selection was made", JOptionPane.ERROR_MESSAGE); } else { Container container = SwingUtilities.getAncestorOfClass(JDesktopPane.class, (Component) evt.getSource()); if (container != null) { btnClearSel.setEnabled(false); btnNextScreen.setEnabled(false); JDesktopPane desktopPane = getDesktopPane(); TableRelationsForm frm = new TableRelationsForm(listOfTables, this); desktopPane.add(frm); frm.setVisible(true); frm.setSize(800, 500); frm.setLocation(120, 60); frm.moveToFront(); frm.addInternalFrameListener(new InternalFrameListener() { @Override public void internalFrameOpened(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameClosing(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameClosed(InternalFrameEvent e) { btnClearSel.setEnabled(true); btnNextScreen.setEnabled(true); } @Override public void internalFrameIconified(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameDeiconified(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameActivated(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameDeactivated(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); } } }
From source file:com.emr.schemas.DestinationTables.java
/** * Handles click event for the Next button * <br />/*w ww .j ava 2 s . c o m*/ * Opens the EditMappings form for mapping of source and destination columns. * @param evt {@link ActionEvent} */ private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed //JOptionPane.showMessageDialog(this, "Under Construction", "Under Construction", JOptionPane.INFORMATION_MESSAGE); //get selected destination table if (destinationTablesList.getSelectedIndex() < 0) { JOptionPane.showMessageDialog(this, "Please select a destination table from the list.", "Destination table not selected", JOptionPane.ERROR_MESSAGE); } else { btnNext.setEnabled(false); btnClearSelection.setEnabled(false); String destinationTable = (String) destinationTablesList.getSelectedValue(); JDesktopPane desktopPane = getDesktopPane(); EditMappingsForm frm = new EditMappingsForm(mpiConn, emrConn, selected_columns, destinationTable, sourceQuery, sourceTables, relations, this); desktopPane.add(frm); frm.setVisible(true); frm.setSize(600, 480); frm.setLocation(300, 140); frm.moveToFront(); final DestinationTables currentForm = this; frm.addInternalFrameListener(new InternalFrameListener() { @Override public void internalFrameOpened(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameClosing(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameClosed(InternalFrameEvent e) { btnNext.setEnabled(true); btnClearSelection.setEnabled(true); currentForm.closeForm(); } @Override public void internalFrameIconified(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameDeiconified(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameActivated(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameDeactivated(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); } }
From source file:Main.java
public Main() { JMenuBar bar = new JMenuBar(); JMenu addMenu = new JMenu("Add"); JMenuItem newFrame = new JMenuItem("Internal Frame"); addMenu.add(newFrame);//w w w. j av a2s. co m bar.add(addMenu); setJMenuBar(bar); final JDesktopPane theDesktop = new JDesktopPane(); getContentPane().add(theDesktop); newFrame.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, true); Container c = frame.getContentPane(); MyJPanel panel = new MyJPanel(); c.add(panel, BorderLayout.CENTER); frame.setSize(200, 200); frame.setOpaque(true); theDesktop.add(frame); } }); setSize(500, 400); setVisible(true); }
From source file:com.emr.schemas.TableRelationsForm.java
/** * Handles preview button (Data preview) * @param evt {@link ActionEvent}/*from w w w .j ava2 s . c om*/ */ private void btnPreviewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPreviewActionPerformed int length = selected_columns.size(); if (length < 1) { JOptionPane.showMessageDialog(this, "Please select at least one column from the source columns list.", "No column(s) selected.", JOptionPane.ERROR_MESSAGE); } else { sql = getSourceQueryString(); if ("".equals(sql)) { JOptionPane.showMessageDialog(this, "You selected " + tables.size() + " source tables without matching relationships. Please define relations between all the tables, or go back and refine/change your tables selection.", "Table Relations missing", JOptionPane.ERROR_MESSAGE); } else { JDesktopPane desktopPane = getDesktopPane(); SourceDataPreview frm = new SourceDataPreview(sql, selected_columns); desktopPane.add(frm); frm.setVisible(true); frm.setSize(500, 500); frm.setLocation(120, 60); frm.moveToFront(); } } }
From source file:com.emr.schemas.TableRelationsForm.java
/** * Handles click event for the next button * Opens {@link DestinationTables} form for the user to select the destination table * @param evt {@link ActionEvent}/*from w w w . j a va 2s. c om*/ */ private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed int length = selected_columns.size(); if (length < 1) { JOptionPane.showMessageDialog(this, "Please select at least one column from the source columns list.", "No column(s) selected.", JOptionPane.ERROR_MESSAGE); } else { sql = getSourceQueryString(); if ("".equals(sql)) { JOptionPane.showMessageDialog(this, "You selected " + tables.size() + " source tables without matching relationships. Please define relations between all the tables, or go back and refine/change your tables selection.", "Table Relations missing", JOptionPane.ERROR_MESSAGE); } else { btnNext.setEnabled(false); btnClearSelection.setEnabled(false); //open form for choosing the destination table JDesktopPane desktopPane = getDesktopPane(); DestinationTables frm = new DestinationTables(sql, selected_columns, tables, where_clause, emrConn, this); desktopPane.add(frm); frm.setVisible(true); frm.setSize(900, 500); frm.setLocation(120, 60); frm.moveToFront(); frm.addInternalFrameListener(new InternalFrameListener() { @Override public void internalFrameOpened(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameClosing(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameClosed(InternalFrameEvent e) { btnNext.setEnabled(true); btnClearSelection.setEnabled(true); } @Override public void internalFrameIconified(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameDeiconified(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameActivated(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void internalFrameDeactivated(InternalFrameEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); } } }
From source file:DialogDesktop.java
public DialogDesktop(String title) { super(title); setDefaultCloseOperation(EXIT_ON_CLOSE); final JDesktopPane desk = new JDesktopPane(); setContentPane(desk);/*from w w w . jav a 2s . com*/ // Create our "real" application container; use any layout manager we // want. final JPanel p = new JPanel(new GridBagLayout()); // Listen for desktop resize events so we can resize p. This will ensure // that // our container always fills the entire desktop. desk.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent ev) { Dimension deskSize = desk.getSize(); p.setBounds(0, 0, deskSize.width, deskSize.height); p.validate(); } }); // Add our application panel to the desktop. Any layer below the // MODAL_LAYER // (where the dialogs will appear) is fine. We'll just use the default // in // this example. desk.add(p); // Fill out our app with a few buttons that create dialogs JButton input = new JButton("Input"); JButton confirm = new JButton("Confirm"); JButton message = new JButton("Message"); p.add(input); p.add(confirm); p.add(message); input.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JOptionPane.showInternalInputDialog(desk, "Enter Name"); } }); confirm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JOptionPane.showInternalConfirmDialog(desk, "Is this OK?"); } }); message.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JOptionPane.showInternalMessageDialog(desk, "The End"); } }); }
From source file:com.chris.brkopani.gui.analytics.Graph.java
public void createAndShowGui(JDesktopPane desk) throws SQLException { //? tabed pane ? WebLookAndFeel.install();//from w w w . j a va 2s . c o m frame = new JInternalFrame("PieChart", true, true, true, true); frame.setFrameIcon(new ImageIcon("res/br.png")); frame.setBounds(530, 5, 520, 350); frame.getContentPane().getBackground(); // This will create the dataset PieDataset dataset = createDataset(); // based on the dataset we create the chart JFreeChart chart = createChart(dataset, "PieChart"); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); chart.setBackgroundPaint(Color.GRAY); // default size chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); // add it to our application frame.add(chartPanel); frame.setVisible(true); desk.add(frame); }
From source file:Software_Jframes.chart.java
public void piechart(JDesktopPane jDesktopPane1, String pid) { DefaultPieDataset piedataset = new DefaultPieDataset(); try {//from www .ja v a2s.c o m ResultSet rs = db.statement() .executeQuery("select name,cost from project_level_payment where projectid='" + pid + "' "); while (rs.next()) { String cost = rs.getString("cost"); int cost_int1 = Integer.parseInt(cost); String name = rs.getString("name"); piedataset.setValue(name, new Integer(cost_int1)); } } catch (Exception e) { e.printStackTrace(); } JFreeChart chart = ChartFactory.createPieChart("Costs for Project", piedataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); p.setBackgroundPaint(Color.white); ChartPanel panel = new ChartPanel(chart); jDesktopPane1.add(panel).setSize(440, 300); }
From source file:Software_Jframes.chart.java
public void piechart_customer(JDesktopPane jDesktopPane1, String pid) { DefaultPieDataset piedataset = new DefaultPieDataset(); int cost_total = 0; try {//from w ww . j av a 2 s . c o m ResultSet rs = db.statement().executeQuery("select * from cus_payment where Project_id='" + pid + "' "); while (rs.next()) { String cost = rs.getString("Amount"); int cost_int1 = Integer.parseInt(cost); cost_total = cost_total + cost_int1; } } catch (Exception e) { e.printStackTrace(); } piedataset.setValue("Amount Received", cost_total); piedataset.setValue("Amount to be Received", 7854); JFreeChart chart = ChartFactory.createPieChart("Costs for Project", piedataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); p.setBackgroundPaint(Color.white); ChartPanel panel = new ChartPanel(chart); jDesktopPane1.add(panel).setSize(500, 230); }