static ComponentBuilder getBuilder(Instance instance, Heap heap) { if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) { return new JRootPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) { return new JDesktopPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) { return new JLayeredPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) { return new FrameBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) { return new DialogBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) { return new JInternalFrameBuilder(instance, heap); } return null; }
/** * Tab maximize. */ private void tabMaximize() { // --- Maximize the main window --------------------------------------- // Application.getMainWindow().setExtendedState(JFrame.MAXIMIZED_BOTH); // --- Open a new JInteraFrame with the current tab enlarged ---------- SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JDesktopPane appDesktop = Application.getMainWindow().getJDesktopPane4Projects(); if (maxTab == null) { appDesktop.add(getMaximizedTab()); Application.getMainWindow().addJToolbarComponent(getMaximizedTab().getJButtonRestore4MainToolBar()); } DesktopManager dtm = Application.getMainWindow().getJDesktopPane4Projects().getDesktopManager(); if (dtm != null) { dtm.activateFrame(getMaximizedTab()); dtm.maximizeFrame(getMaximizedTab()); } } }); }
public InternalFrameDemo() { super("InternalFrameDemo"); // Make the big window be indented 50 pixels from each edge // of the screen. int inset = 50; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2); // Set up the GUI. desktop = new JDesktopPane(); // a specialized layered pane createFrame(); // create first "window" setContentPane(desktop); setJMenuBar(createMenuBar()); // Make dragging a little faster but perhaps uglier. desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); }
/** * Return true if the given component is likely to be a container such the each * component within the container should be be considered as a user input. * * @param c * @return true if the component children should have this listener added. */ protected boolean isProbablyAContainer (Component c) { boolean result = extListener != null ? extListener.isContainer(c) : false; if (!result) { boolean isSwing = isSwingClass(c); if (isSwing) { result = c instanceof JPanel || c instanceof JSplitPane || c instanceof JToolBar || c instanceof JViewport || c instanceof JScrollPane || c instanceof JFrame || c instanceof JRootPane || c instanceof Window || c instanceof Frame || c instanceof Dialog || c instanceof JTabbedPane || c instanceof JInternalFrame || c instanceof JDesktopPane || c instanceof JLayeredPane; } else { result = c instanceof Container; } } return result; }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String pattern1 = "[A-z\\s]*"; String fname = jTextField6.getText(); String box1 = jTextField1.getText(); String box2 = jTextField2.getText(); String box3 = jTextField3.getText(); String box4 = jTextField4.getText(); String box5 = jTextField5.getText(); Integer box7 = Integer.parseInt(jTextField7.getText()); Integer box8 = Integer.parseInt(jTextField8.getText()); if((fname.matches(pattern1))&&(box1.length()==4)&&(box2.length()==4)&&(box3.length()==4)&&(box4.length()==4)&&(box5.length()==3)&&(box7<12)&&(box8>17)) { JOptionPane.showMessageDialog(rootPane, "payment detils wrong"); JDesktopPane desktopPane = getDesktopPane(); Customerlogin cl =new Customerlogin(cus.getPass_no()); desktopPane.add(cl); cl.setVisible(true); this.dispose(); } // TODO add your handling code here: }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed JDesktopPane desktopPane = getDesktopPane(); int class_ = Integer.parseInt(jComboBox2.getSelectedItem().toString()); LegClasses lc = new LegClasses(fl.getLeg_no(), class_); if (!lc.isExist()) { JOptionPane.showMessageDialog(rootPane, "Error: Selected Flight doesnt have that class type"); } else { float amount = lc.getPrice(); Tickets tk = new Tickets(); tk.setLeg_no(fl.getLeg_no()); tk.setClass_(class_); tk.setPass_no(cus.getPass_no()); tk.setSeat_no(Integer.parseInt(jComboBox1.getSelectedItem().toString())); if (!tk.save()) { JOptionPane.showMessageDialog(rootPane, "Error: Could not reserve ticket"); } else { Payment p = new Payment(cus.getPass_no(), amount); desktopPane.add(p); p.setVisible(true); this.dispose(); } } }
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed JDesktopPane desktopPane = getDesktopPane(); String user = jTextField3.getText(); String pass = new String(jPasswordField2.getPassword()); Admin a = new Admin(); if (a.adminLogin(user, pass)) { Adminlogin al = new Adminlogin(); desktopPane.add(al); al.setVisible(true); this.dispose(); } else { JOptionPane.showMessageDialog(rootPane, "Error: Username or password incorrect"); } }
public static void highlightNext(String findText) { int sel = jTabbedPane1.getSelectedIndex(); JTextPane textPane = (JTextPane) ((JScrollPane) ((JDesktopPane)jTabbedPane1.getComponentAt(sel)).getComponent(0)).getViewport().getComponent(0); if (findText.isEmpty()) return; String context = textPane.getText(); String wordToFind = findText; pos = context.indexOf(wordToFind, currentPos); if (pos == -1) currentPos = 0; pos = context.indexOf(wordToFind, currentPos); currentPos = pos; if (pos != -1) { textPane.setSelectionStart(pos); textPane.setSelectionEnd(pos + wordToFind.length()); textPane.requestFocusInWindow(); currentPos = (currentPos + 1); } else { currentPos = 0; } }
public static void findNext() { int sel = jTabbedPane1.getSelectedIndex(); JTextPane textPane = (JTextPane) ((JScrollPane) ((JDesktopPane)jTabbedPane1.getComponentAt(sel)).getComponent(0)).getViewport().getComponent(0); if (findword.getText().isEmpty()) return; String context = textPane.getText(); String wordToFind = findword.getText(); pos = context.indexOf(wordToFind, currentPos); if (pos == -1) currentPos = 0; pos = context.indexOf(wordToFind, currentPos); currentPos = pos; if (pos != -1) { textPane.setSelectionStart(pos); textPane.setSelectionEnd(pos + wordToFind.length()); textPane.requestFocusInWindow(); currentPos = (currentPos + 1); } else { currentPos = 0; notfound.setVisible(true); } }
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
public static void main(String[] args) throws Exception { defaultBackgroudColor = (Color) Toolkit.getDefaultToolkit() .getDesktopProperty("win.mdi.backgroundColor"); String[] lookAndFeel = new String[]{ "com.sun.java.swing.plaf.windows.WindowsLookAndFeel", "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"}; for (String laf : lookAndFeel) { UIManager.setLookAndFeel(laf); SwingUtilities.invokeAndWait(() -> { JDesktopPane desktopPane = new JDesktopPane(); Color background = desktopPane.getBackground(); if (!background.equals(defaultBackgroudColor)) { throw new RuntimeException("Invalid JDesktopPane " + "Background Color for WLAF"); } }); } }
private static void createUI() { frame = new JFrame(); frame.setUndecorated(true); frame.setSize(300, 300); frame.setLocationRelativeTo(null); final JDesktopPane pane = new JDesktopPane(); final JPanel panel = new JPanel() { @Override protected void paintComponent(Graphics g) { g.setColor(color); g.fillRect(0, 0, getWidth(), getHeight()); } }; jif = new JInternalFrame(); jif.add(panel); jif.setVisible(true); jif.setSize(300, 300); pane.add(jif); frame.add(pane); frame.setVisible(true); }
private static void createAndShowGUI() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); desktopPane = new JDesktopPane(); desktopPane.setBackground(BACKGROUND_COLOR); frame.add(desktopPane, BorderLayout.CENTER); frame.setSize(FRAME_SIZE, FRAME_SIZE); frame.setVisible(true); internalFrame = new JInternalFrame("Test"); internalFrame.setSize(FRAME_SIZE / 2, FRAME_SIZE / 2); desktopPane.add(internalFrame); internalFrame.setVisible(true); internalFrame.setResizable(true); frame.setVisible(true); }
private static void createUI(String lookAndFeelString) { internalFrame = new JInternalFrame("Internal", true, true, true, true); internalFrame.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE); internalFrame.setSize(200, 200); JDesktopPane desktopPane = new JDesktopPane(); desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); desktopPane.add(internalFrame); mainFrame = new JFrame(lookAndFeelString); mainFrame.setSize(640, 480); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setContentPane(desktopPane); mainFrame.setVisible(true); internalFrame.setVisible(true); }
/** * Create a panel in which a JDesktopPane is used to * to display screens for viewing a Player. * * @param title * Title displayed in border of JDesktopPane */ public ViewingPanel(String title) { TitledBorder tb; setLayout(new BorderLayout()); desktop = new JDesktopPane(); desktop.setLayout(new TileLayout()); desktop.setBorder(tb = new TitledBorder( new CompoundBorder( new EtchedBorder(), new EmptyBorder(4, 4, 4, 4)), title)); tb.setTitleColor(Color.black); desktop.setOpaque(false); desktop.setBackground(UIManager.getColor("control")); add(desktop, BorderLayout.CENTER); hash = new Hashtable(); }
private void buildWindow() { JFrame frame = new JFrame("Project GoldStars X"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1100 * ProjectGoldStarsX.multiplier, 575 * ProjectGoldStarsX.multiplier); frame.setExtendedState(frame.MAXIMIZED_BOTH); frame.setLayout(new BorderLayout()); frame.setUndecorated(true); frame.setIconImage(getImage()); frame.getContentPane().setBackground(ProjectGoldStarsX.color1); frame.setJMenuBar(menuBar()); ProjectGoldStarsX.desktop = new JDesktopPane(); background(); frame.add(ProjectGoldStarsX.desktop); frame.setVisible(true); }
/** Creates new form ModifyDatabaseStructureInternalFrame */ public ModifyDatabaseStructureInternalFrame(JDesktopPane dtp) { initComponents(); this.dtp = dtp; regionComboBox.setModel(new DefaultComboBoxModel(new String[]{ Globals.REGIONS[1], Globals.REGIONS[2], Globals.REGIONS[3], Globals.REGIONS[4], Globals.REGIONS[5], Globals.REGIONS[6], Globals.REGIONS[9] })); setListeners(); // searchVariablesPanel.setEnabled(true); // databaseIndexPanel.setVisible(false); codingPanel.setVisible(false); settingsPanel.setVisible(false); }
/** Creates new form ComparePatientsInternalFrame */ public ComparePatientsInternalFrame(JDesktopPane desktopPane) { this.desktopPane = desktopPane; initComponents(); firstColumnName = "Merge"; firstColumnName = "-----"; globalToolBox = canreg.client.CanRegClientApp.getApplication().getGlobalToolBox(); patientIDlookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientID.toString()).getDatabaseVariableName(); tumourIDlookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.TumourID.toString()).getDatabaseVariableName(); patientIDTumourTablelookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientIDTumourTable.toString()).getDatabaseVariableName(); Document doc = globalToolBox.getDocument(); PersonSearchVariable[] searchVariables = Tools.getPersonSearchVariables(doc, Globals.NAMESPACE); LinkedList<String> defaultColumnsList = new LinkedList<String>(); // defaultColumnsList.add(patientIDlookupVariable); for (PersonSearchVariable psv : searchVariables) { defaultColumnsList.add(psv.getName()); } defaultColumns = defaultColumnsList.toArray(new String[0]); recordSets = new LinkedList<Pair<Patient, Tumour[]>>(); percentList = new LinkedList<Float>(); mergeButton.setVisible(false); localSettings = CanRegClientApp.getApplication().getLocalSettings(); }
/** * Creates new form FrequenciesByYearInternalFrame * * @param dtp */ public FrequenciesByYearInternalFrame(JDesktopPane dtp) { this.dtp = dtp; dictionary = CanRegClientApp.getApplication().getDictionary(); initComponents(); initOtherComponents(); localSettings = CanRegClientApp.getApplication().getLocalSettings(); addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { close(); } }); }
/** * Creates new form BrowseInternalFrame * * @param dtp */ public BrowseInternalFrame(JDesktopPane dtp) { this.dtp = dtp; globalToolBox = CanRegClientApp.getApplication().getGlobalToolBox(); patientIDlookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientID.toString()).getDatabaseVariableName(); patientIDTumourTablelookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientIDTumourTable.toString()).getDatabaseVariableName(); patientRecordIDTumourTablelookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientRecordIDTumourTable.toString()).getDatabaseVariableName(); patientRecordIDVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientRecordID.toString()).getDatabaseVariableName(); tumourIDlookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.TumourID.toString()).getDatabaseVariableName(); tumourIDSourceTableLookupVariable = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.TumourIDSourceTable.toString()).getDatabaseVariableName(); patientIDLength = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.PatientID.toString()).getVariableLength(); tumourIDLength = globalToolBox.translateStandardVariableNameToDatabaseListElement(Globals.StandardVariableNames.TumourID.toString()).getVariableLength(); localSettings = CanRegClientApp.getApplication().getLocalSettings(); initComponents(); initOtherComponents(); initValues(); pack(); }
private void enableDisableOverlay() { Insight ii = questionSelector.getItemAt( questionSelector.getSelectedIndex() ); if ( null == ii ) { appendChkBox.setEnabled( false ); } else { //Determine whether to enable/disable the "Overlay" CheckBox, based upon //how the renderer of the selected visualization compares with that of the //currently selected question: JDesktopPane pane = DIHelper.getInstance().getDesktop(); OutputTypeRegistry registry = DIHelper.getInstance().getOutputTypeRegistry(); PlaySheetFrame psf = PlaySheetFrame.class.cast( pane.getSelectedFrame() ); PlaySheetCentralComponent pscc = ( null == psf ? null : psf.getActivePlaySheet() ); Class<? extends IPlaySheet> psccClass = ( null == pscc ? null : pscc.getClass() ); final InsightOutputType type = ii.getOutput(); appendChkBox.setEnabled( null == type ? false : type.equals( registry.getTypeFromClass( psccClass ) ) ); } if ( !appendChkBox.isEnabled() ) { appendChkBox.setSelected( false ); } }
public static void storePersistanceInfo(JDesktopPane desktop) throws IOException { CacheListController top = getTopViewCacheController(desktop); ArrayList<PersistenceInfo> pi = new ArrayList<>(); for (CacheListController clc : controllerList) { if (clc == top) continue; pi.add(clc.getPersistenceO()); } if (top != null) pi.add(top.getPersistenceO()); Settings.setSerialized(Settings.Key.CLC_LIST, pi); }
/** * Add a new frame into the main frame. * * @param project project frame to add */ void addProjectFrame(final JDesktopPane desktop, final ProjectFrame project) { if (project instanceof FloatingProjectFrame) { try { FloatingProjectFrame floatingProject = (FloatingProjectFrame) project; logger.debug("N°" + desktop.getAllFrames().length); desktop.add(floatingProject.getInternalFrame()); floatingProject.getInternalFrame().setVisible(true); floatingProject.getInternalFrame().setSelected(true); desktop.setSelectedFrame(floatingProject.getInternalFrame()); } catch (Exception e) { e.printStackTrace(); logger.error("not allowed to set floatingProject visible and selected"); } } else { logger.error("Cannot add a " + project.getClass().getSimpleName() + " into a " + this.getClass().getSimpleName()); } }
/** * Get all frames of the CURRENT desktop */ @Override public final ProjectFrame[] getDesktopProjectFrames() { List<ProjectFrame> projectFrameList = new ArrayList<ProjectFrame>(); JDesktopPane currentDesktop = this.getCurrentDesktop(); if (currentDesktop == null) { return new ProjectFrame[0]; } for (JInternalFrame frameGui : currentDesktop.getAllFrames()) { ProjectFrame projectFrame = this.getProjectFrameFromGui(frameGui); if (projectFrame != null) { projectFrameList.add(projectFrame); } } return projectFrameList.toArray(new ProjectFrame[0]); }
public void organizeCurrentDesktop(int ncol) { JDesktopPane currentDesktop = this.getCurrentDesktop(); if (currentDesktop == null) { return; } ProjectFrame[] projectFrames = this.getDesktopProjectFrames(); currentDesktop.removeAll(); GridLayout layout = new GridLayout(0, ncol); currentDesktop.setLayout(layout); for (ProjectFrame project : projectFrames) { currentDesktop.add(project.getGui()); } currentDesktop.doLayout(); currentDesktop.setLayout(null); // now set layout to free moves }
@SuppressWarnings("unchecked") protected void setup() { // ----- get the arguments/coordinates of gol.acl.agents -------------------------------- agentArgs = this.getArguments(); cRow = (Integer) agentArgs[0]; cCol = (Integer) agentArgs[1]; localEnvModel = (HashMap<String, Integer>) agentArgs[2]; // ---------- start and show GUI ------------------------------------------------ gui = new GameOfLifeGUI(cRow, cCol, this); gui.bClear.setEnabled(false); gui.bPause.setEnabled(false); gui.bStart.setEnabled(false); gui.setResizable(true); gui.setMaximizable(true); JDesktopPane desptop = Application.getProjectFocused().getProjectDesktop(); desptop.add(gui); desptop.getDesktopManager().maximizeFrame(gui); doWait(3000); // --- Start cyclic behaviour for this Manager Agent ---------------------------- this.addBehaviour(new StepBehaviour()); this.addBehaviour(new ReceiveBehaviour()); gui.bClear.setEnabled(true); gui.bPause.setEnabled(false); gui.bStart.setEnabled(true); }
/** * Gets the progress monitor. * * @param windowTitle the window title * @param headerText the header text * @param progressText the progress text * @return the progress monitor */ public AwbProgressMonitor getProgressMonitor(String windowTitle, String headerText, String progressText) { AwbProgressMonitor progressMonitor = null; switch (this.getVisualisationPlatform()) { case EclipseFramework: // --- SWT progress visualization dialog ---------------- //TODO System.err.println("SWT Progress Monitor not implemented yet!"); break; case AgentGuiSwing: // --- Swing progress visualization dialog -------------------- // --- Try to get a JDesktopPane ---------------------------- JDesktopPane desktop = null; if (Application.getMainWindow() != null) { desktop = Application.getMainWindow().getJDesktopPane4Projects(); } // --- Get the image icon for the progress monitor ---------- ImageIcon imageIcon = GlobalInfo.getInternalImageIcon("AgentGUI.png"); // --- Get the look and feel -------------------------------- String lookAndFeelClassName = Application.getGlobalInfo().getAppLookAndFeelClassName(); progressMonitor = new org.agentgui.gui.swing.dialogs.ProgressMonitor(windowTitle, headerText, progressText, imageIcon, desktop, lookAndFeelClassName); break; } return progressMonitor; }
public DesktopFrame() { super("Using a JDesktopPane"); JMenuBar bar = new JMenuBar(); JMenu addMenu = new JMenu("Add"); JMenuItem newFrame = new JMenuItem("Internal Frame"); addMenu.add(newFrame); // add new frame item to Add menu bar.add(addMenu); // add Add menu to menu bar setJMenuBar(bar); // set menu bar for this application theDesktop = new JDesktopPane(); add(theDesktop); // add desktop pane to frame // set up listener for newFrame menu item newFrame.addActionListener( new ActionListener() // anonymous inner class { // display new internal window @Override public void actionPerformed(ActionEvent event) { // create internal frame JInternalFrame frame = new JInternalFrame( "Internal Frame", true, true, true, true); MyJPanel panel = new MyJPanel(); frame.add(panel, BorderLayout.CENTER); frame.pack(); // set internal frame to size of contents theDesktop.add(frame); // attach internal frame frame.setVisible(true); // show internal frame } } ); }
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed JDesktopPane desktopPane = getDesktopPane(); Customerlogin cr = new Customerlogin(cus.getPass_no()); desktopPane.add(cr); cr.setVisible(true); this.dispose(); }
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed JDesktopPane desktopPane = getDesktopPane(); Login lo =new Login(); desktopPane.add(lo); lo.setVisible(true); this.dispose(); // TODO add your handling code here: }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: JDesktopPane desktopPane = getDesktopPane(); ManageAirport mngair =new ManageAirport(); desktopPane.add(mngair); mngair.setVisible(true); this.dispose(); }