public static void createAndShowGUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("@title@"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.getContentPane().add(new MainPanel()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
@SuppressWarnings("OverridableMethodCallInConstructor") Notepad() { super(true); // Trying to set Nimbus look and feel try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ignored) { } setBorder(BorderFactory.createEtchedBorder()); setLayout(new BorderLayout()); // create the embedded JTextComponent editor = createEditor(); // Add this as a listener for undoable edits. editor.getDocument().addUndoableEditListener(undoHandler); // install the command table commands = new HashMap<Object, Action>(); Action[] actions = getActions(); for (Action a : actions) { commands.put(a.getValue(Action.NAME), a); } JScrollPane scroller = new JScrollPane(); JViewport port = scroller.getViewport(); port.add(editor); String vpFlag = getProperty("ViewportBackingStore"); if (vpFlag != null) { Boolean bs = Boolean.valueOf(vpFlag); port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE); } JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add("North", createToolbar()); panel.add("Center", scroller); add("Center", panel); add("South", createStatusbar()); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exemp) { exemp.printStackTrace(); } PanelSgavtraslo panel = new PanelSgavtraslo(); panel.setBindingContext( JUTestFrame.startTestFrame( "DataBindings.cpx", "AppModuleDataControl1", panel, panel.getPanelBinding(), new Dimension(400, 300))); panel.revalidate(); ViewObject voTraslo = panel.panelBinding.findIteratorBinding("SgavtrasloEntSal1Iter").getViewObject(); System.out.println("whereClause: " + voTraslo.getWhereClause()); // Michael 19.12.2007 pruebas AppModuleImpl am = (AppModuleImpl) panel.panelBinding.getApplication().getApplicationModule(); SgavestadoentradaslomacViewImpl vo = am.getSgavestadoentradaslomacView1(); vo.setWhereClauseParam(0, "300000008212"); vo.executeQuery(); SgavestadoentradaslomacViewRowImpl vr = (SgavestadoentradaslomacViewRowImpl) vo.first(); oracle.jbo.domain.Number num = new oracle.jbo.domain.Number(1); vr.setUbicacionDestinoMac(num); // Traslo traslo = new Traslo(1, "SLO", am); // traslo.test(); // TODO 19.12.2007 }
// ------------------------------------------------------------------------ TextViewer(JFrame inParentFrame) { // super(true); //is double buffered - only for panels textViewerFrame = this; parentFrame = inParentFrame; lastViewedDirStr = ""; lastViewedFileStr = ""; setTitle(resources.getString("Title")); addWindowListener(new AppCloser()); pack(); setSize(500, 600); warningPopup = new WarningDialog(this); okCancelPopup = new WarningDialogOkCancel(this); messagePopup = new MessageDialog(this); okCancelMessagePopup = new MessageDialogOkCancel(this); // Force SwingSet to come up in the Cross Platform L&F try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); // If you want the System L&F instead, comment out the above line and // uncomment the following: // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exc) { String errstr = "TextViewer:Error loading L&F: " + exc; warningPopup.display(errstr); } Container cf = getContentPane(); cf.setBackground(Color.lightGray); // Border etched=BorderFactory.createEtchedBorder(); // Border title=BorderFactory.createTitledBorder(etched,"TextViewer"); // cf.setBorder(title); cf.setLayout(new BorderLayout()); // create the embedded JTextComponent editor1 = createEditor(); editor1.setFont(new Font("monospaced", Font.PLAIN, 12)); // aa -added next line setPlainDocument((PlainDocument) editor1.getDocument()); // sets doc1 // install the command table commands = new Hashtable(); Action[] actions = getActions(); for (int i = 0; i < actions.length; i++) { Action a = actions[i]; commands.put(a.getValue(Action.NAME), a); // System.out.println("Debug:TextViewer: actionName:"+a.getValue(Action.NAME)); } // editor1.setPreferredSize(new Dimension(,)); // get setting from user preferences if (UserPref.keymapType.equals("Word")) { editor1 = updateKeymapForWord(editor1); } else { editor1 = updateKeymapForEmacs(editor1); } scroller1 = new JScrollPane(); viewport1 = scroller1.getViewport(); viewport1.add(editor1); scroller1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scroller1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); try { String vpFlag = resources.getString("ViewportBackingStore"); Boolean bs = new Boolean(vpFlag); viewport1.setBackingStoreEnabled(bs.booleanValue()); } catch (MissingResourceException mre) { System.err.println("TextViewer:missing resource:" + mre.getMessage()); // just use the viewport1 default } menuItems = new Hashtable(); menubar = createMenubar(); lowerPanel = new JPanel(true); // moved double buffering to here lowerPanel.setLayout(new BorderLayout()); lowerPanel.add("North", createToolbar()); lowerPanel.add("Center", scroller1); cf.add("North", menubar); cf.add("Center", lowerPanel); cf.add("South", createStatusbar()); // for the find/search utilities mySearchDialog = new SearchDialog(this); // System.out.println("Debug:TextViewer: end of TextViewer constructor"); }
/** Constructor to create the frame and its components */ public CoreyTextEditor() { // Create a scroll pane area.setFont(new Font("Monospaced", Font.PLAIN, 12)); JScrollPane scroll = new JScrollPane( area, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); add(scroll, BorderLayout.CENTER); // Adds the system default look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) { e.printStackTrace(); } // Create a menu bar JMenuBar JMB = new JMenuBar(); setJMenuBar(JMB); JMenu file = new JMenu("File"); JMenu edit = new JMenu("Edit"); JMB.add(file); JMB.add(edit); // Finishing our menu bar file.add(New); file.add(Open); file.add(Save); file.add(SaveAs); file.addSeparator(); file.add(Quit); edit.add(Cut); edit.add(Copy); edit.add(Paste); edit.getItem(0).setText("Cut"); edit.getItem(0).setIcon(new ImageIcon("cut.gif")); edit.getItem(1).setText("Copy"); edit.getItem(1).setIcon(new ImageIcon("copy.gif")); edit.getItem(2).setText("Paste"); edit.getItem(2).setIcon(new ImageIcon("paste.gif")); // Time to make a toolbar! JToolBar tool = new JToolBar(); add(tool, BorderLayout.NORTH); tool.add(New); tool.add(Open); tool.add(Save); tool.addSeparator(); JButton cut = tool.add(Cut); JButton cop = tool.add(Copy); JButton pas = tool.add(Paste); cut.setText(null); cut.setIcon(new ImageIcon("cut.gif")); cop.setText(null); cop.setIcon(new ImageIcon("copy.gif")); pas.setText(null); pas.setIcon(new ImageIcon("paste.gif")); Save.setEnabled(false); SaveAs.setEnabled(false); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); pack(); /* KeyListener to change Save and SaveAs */ KeyListener k1 = new KeyAdapter() { public void keyPressed(KeyEvent e) { changed = true; Save.setEnabled(true); SaveAs.setEnabled(true); } }; area.addKeyListener(k1); setTitle(currentFile + " - CoreyTextEditor"); setVisible(true); }