List of usage examples for java.awt Dimension getHeight
public double getHeight()
From source file:net.lmxm.ute.preferences.AbstractPreferences.java
/** * Sets the dimension.//from w w w .java2s . co m * * @param key the key * @param dimension the dimension */ protected final void setDimension(final String key, final Dimension dimension) { final String prefix = "setDimension() :"; LOGGER.debug("{} entered, key={}", prefix, key); if (dimension == null) { LOGGER.debug("{} dimension is null, returning without setting", prefix); return; } setInt(key + HEIGHT_SUFFIX, (int) dimension.getHeight()); setInt(key + WIDTH_SUFFIX, (int) dimension.getWidth()); LOGGER.debug("{} leaving", prefix); }
From source file:fxts.stations.util.preferences.EditAction.java
public void actionPerformed(ActionEvent aEvent) { JButton okButton = UIManager.getInst().createButton(); JButton cancelButton = UIManager.getInst().createButton(); final JDialog dialog = new JDialog(mEditorPanel.getParentDialog()); dialog.setTitle(mEditorPanel.getTitle()); JPanel editPanel = new JPanel(); JPanel buttonPanel = new JPanel(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(UIFrontEnd.getInstance().getSideLayout()); //mainPanel.setLayout(new SideLayout()); //sets button panel buttonPanel.setLayout(UIFrontEnd.getInstance().getSideLayout()); okButton.setText(mResMan.getString("IDS_OK_BUTTON")); //okButton.setPreferredSize(new Dimension(80, 27)); GridBagConstraints sideConstraints = UIFrontEnd.getInstance().getSideConstraints(); sideConstraints.insets = new Insets(10, 10, 10, 10); sideConstraints.gridx = 0;// w w w. ja v a 2 s .c om sideConstraints.gridy = 0; ResizeParameterWrapper resizeParameter = UIFrontEnd.getInstance().getResizeParameter(); resizeParameter.init(0.5, 0.0, 0.5, 0.0); resizeParameter.setToConstraints(sideConstraints); buttonPanel.add(okButton, sideConstraints); cancelButton.setText(mResMan.getString("IDS_CANCEL_BUTTON")); //cancelButton.setPreferredSize(new Dimension(80, 27)); sideConstraints = UIFrontEnd.getInstance().getSideConstraints(); sideConstraints.insets = new Insets(10, 10, 10, 10); sideConstraints.gridx = 1; sideConstraints.gridy = 0; resizeParameter = UIFrontEnd.getInstance().getResizeParameter(); resizeParameter.init(0.5, 0.0, 0.5, 0.0); resizeParameter.setToConstraints(sideConstraints); buttonPanel.add(cancelButton, sideConstraints); //adds button panel sideConstraints = UIFrontEnd.getInstance().getSideConstraints(); sideConstraints.insets = new Insets(10, 10, 10, 10); sideConstraints.gridx = 0; sideConstraints.gridy = 1; resizeParameter = UIFrontEnd.getInstance().getResizeParameter(); resizeParameter.init(0.0, 1.0, 1.0, 1.0); resizeParameter.setToConstraints(sideConstraints); mainPanel.add(buttonPanel, sideConstraints); //sets edit panel final IEditor editor = mType.getEditor(); editor.setValue(mValue); editPanel.setLayout(UIFrontEnd.getInstance().getSideLayout()); sideConstraints = UIFrontEnd.getInstance().getSideConstraints(); resizeParameter = UIFrontEnd.getInstance().getResizeParameter(); resizeParameter.init(0.0, 0.0, 1.0, 1.0); resizeParameter.setToConstraints(sideConstraints); Component editComp = editor.getComponent(); //Mar 25 2004 - kav: added for right tab order at Font Chooser at java 1.4. if (editComp instanceof FontChooser) { FontChooser fc = (FontChooser) editComp; fc.setNextFocusedComp(okButton); } editPanel.add(editComp, sideConstraints); //adds editor panel sideConstraints = UIFrontEnd.getInstance().getSideConstraints(); sideConstraints.gridx = 0; sideConstraints.gridy = 0; resizeParameter = UIFrontEnd.getInstance().getResizeParameter(); resizeParameter.init(0.0, 0.0, 1.0, 1.0); resizeParameter.setToConstraints(sideConstraints); mainPanel.add(editPanel, sideConstraints); //adds main panel dialog.getContentPane().setLayout(UIFrontEnd.getInstance().getSideLayout()); //dialog.getContentPane().setLayout(new SideLayout()); sideConstraints = UIFrontEnd.getInstance().getSideConstraints(); sideConstraints.fill = GridBagConstraints.BOTH; resizeParameter = UIFrontEnd.getInstance().getResizeParameter(); resizeParameter.init(0.0, 0.0, 1.0, 1.0); resizeParameter.setToConstraints(sideConstraints); dialog.getContentPane().add(mainPanel, sideConstraints); //adds listeners to buttons okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvent) { if (editor.getValue().equals(mValue)) { // } else { mValue = editor.getValue(); mEditorPanel.setValue(mValue); mEditorPanel.refreshControls(); mEditorPanel.setValueChanged(true); } dialog.setVisible(false); dialog.dispose(); } }); okButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "ExitAction"); okButton.getActionMap().put("ExitAction", new AbstractAction() { /** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent aEvent) { editor.setValue(mValue); dialog.setVisible(false); dialog.dispose(); } }); okButton.requestFocus(); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvent) { editor.setValue(mValue); dialog.setVisible(false); dialog.dispose(); } }); //dialog.setResizable(false); dialog.setModal(true); dialog.pack(); //sets minimal sizes for components Dimension dim = mainPanel.getSize(); mainPanel.setMinimumSize(dim); mainPanel.setPreferredSize(dim); //sets size of buttons Dimension dimOkButton = okButton.getSize(); Dimension dimCancelButton = cancelButton.getSize(); int nMaxWidth = dimOkButton.getWidth() > dimCancelButton.getWidth() ? (int) dimOkButton.getWidth() : (int) dimCancelButton.getWidth(); okButton.setPreferredSize(new Dimension(nMaxWidth, (int) dimOkButton.getHeight())); okButton.setSize(new Dimension(nMaxWidth, (int) dimOkButton.getHeight())); cancelButton.setPreferredSize(new Dimension(nMaxWidth, (int) dimCancelButton.getHeight())); cancelButton.setSize(new Dimension(nMaxWidth, (int) dimCancelButton.getHeight())); dialog.setLocationRelativeTo(dialog.getOwner()); dialog.setVisible(true); }
From source file:org.photovault.swingui.JAIPhotoViewer.java
public void fit() { isFit = true;/*from w w w . j a v a 2 s . c o m*/ Dimension displaySize = scrollPane.getSize(); log.debug("fit to " + displaySize.getWidth() + ", " + displaySize.getHeight()); imageView.fitToRect(displaySize.getWidth() - 6, displaySize.getHeight() - 6); }
From source file:codes.thischwa.c5c.DispatcherPUT.java
private void imageProcessingAndSizeCheck(Path tempPath, String sanitizedName, long fileSize, FilemanagerConfig conf) throws C5CException, IOException { Integer maxSize = (conf.getUpload().isFileSizeLimitAuto()) ? PropertiesLoader.getMaxUploadSize() : conf.getUpload().getFileSizeLimit(); if (fileSize > maxSize.longValue() * 1024 * 1024) throw new FilemanagerException(FilemanagerAction.UPLOAD, FilemanagerException.Key.UploadFilesSmallerThan, String.valueOf(maxSize)); String extension = FilenameUtils.getExtension(sanitizedName); // check image only boolean isImageExt = checkImageExtension(sanitizedName, conf.getUpload().isImagesOnly(), conf.getImages().getExtensions()); if (!isImageExt) return;// w w w. j a v a 2 s . c o m // remove exif data Path woExifPath = UserObjectProxy.removeExif(tempPath); if (!tempPath.equals(woExifPath)) { Files.move(woExifPath, tempPath, StandardCopyOption.REPLACE_EXISTING); } // check if the file is really an image InputStream in = new BufferedInputStream(Files.newInputStream(tempPath, StandardOpenOption.READ)); Dimension dim = getDimension(in); if (isImageExt && dim == null) throw new FilemanagerException(FilemanagerAction.UPLOAD, FilemanagerException.Key.UploadImagesOnly); IOUtils.closeQuietly(in); // check if resize is enabled and fix it, if necessary Resize resize = conf.getImages().getResize(); if (resize.isEnabled() && (dim.getHeight() > resize.getMaxHeight() || dim.getWidth() > resize.getMaxWidth())) { logger.debug("process resize"); StreamContent sc = connector.resize(new BufferedInputStream(Files.newInputStream(tempPath)), extension, new Dimension(resize.getMaxWidth(), resize.getMaxHeight())); Files.copy(sc.getInputStream(), tempPath, StandardCopyOption.REPLACE_EXISTING); IOUtils.closeQuietly(sc.getInputStream()); } }
From source file:ireport_5_6_0.view.JasperViewer.java
/** This method is called from within the constructor to * initialize the form.//from w w w . j a v a2 s . c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents pnlMain = new javax.swing.JPanel(); setTitle("JasperViewer"); setIconImage( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/jricon.GIF")) .getImage()); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(); } }); pnlMain.setLayout(new java.awt.BorderLayout()); getContentPane().add(pnlMain, java.awt.BorderLayout.CENTER); pack(); Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit(); java.awt.Dimension screenSize = toolkit.getScreenSize(); int screenResolution = toolkit.getScreenResolution(); float zoom = ((float) screenResolution) / JRViewer.REPORT_RESOLUTION; int height = (int) (550 * zoom); if (height > screenSize.getHeight()) { height = (int) screenSize.getHeight(); } int width = (int) (750 * zoom); if (width > screenSize.getWidth()) { width = (int) screenSize.getWidth(); } java.awt.Dimension dimension = new java.awt.Dimension(width, height); setSize(dimension); setLocation((screenSize.width - width) / 2, (screenSize.height - height) / 2); }
From source file:view.TimelinePanel.java
/** * Creates new form TimelinePanel//w w w .j av a 2 s . c o m */ public TimelinePanel() { initComponents(); fxPanel = new JFXPanel(); final Dimension size = new Dimension(960, 750); fxPanel.setSize(size); setLayout(new BorderLayout(0, 0)); add(fxPanel); Platform.runLater(new Runnable() { // this will run initFX as JavaFX-Thread @Override public void run() { Group group = new Group(); Scene scene = new Scene(group); fxPanel.setScene(scene); WebView webView = new WebView(); group.getChildren().add(webView); webView.setMinSize(size.getWidth(), size.getHeight()); webView.setMaxSize(size.getWidth(), size.getHeight()); WebEngine webEngine = webView.getEngine(); webEngine.load( "http://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=0Ag1_iE674IuvdEFaZi0wOVBFY2l2OHdPUWlrZEMwaHc&font=Bevan-PotanoSans&maptype=toner&lang=en"); } }); }
From source file:de.xplib.xdbm.ui.Application.java
/** * /*ww w .j a v a 2 s.c o m*/ */ private void initUI() { this.getContentPane().setLayout(new DockLayout(this, DockLayout.STACKING_STYLE)); this.menuBar = new ApplicationMenuBar(this); this.toolBars = new ApplicationToolBars(this); this.consolePanel = new BottomFrame(this); this.treePanel = new LeftFrame(this); this.resourceFrame = new CenterFrame(this); this.jspContentConsole = new UIFSplitPane(); this.jspTreeResource = new UIFSplitPane(); this.add(this.jspContentConsole, DockLayout.center); this.jspContentConsole.setBorder(BorderFactory.createEmptyBorder()); this.jspContentConsole.setOrientation(JSplitPane.VERTICAL_SPLIT); this.jspContentConsole.setDividerSize(5); this.jspContentConsole.add(this.jspTreeResource, JSplitPane.TOP); this.jspContentConsole.add(this.consolePanel, JSplitPane.BOTTOM); this.jspTreeResource.setBorder(BorderFactory.createEmptyBorder()); this.jspTreeResource.setOrientation(JSplitPane.HORIZONTAL_SPLIT); this.jspTreeResource.setDividerSize(5); this.jspTreeResource.setDividerLocation(200); this.jspTreeResource.add(this.treePanel, JSplitPane.TOP); this.jspTreeResource.add(this.resourceFrame, JSplitPane.BOTTOM); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setSize((int) dim.getWidth(), (int) dim.getHeight() - 30); this.setVisible(true); }
From source file:net.sf.jasperreports.view.JasperViewer.java
/** This method is called from within the constructor to * initialize the form./*from w w w. j a va2 s . co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents pnlMain = new javax.swing.JPanel(); setTitle("JasperViewer"); setIconImage( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/jricon.GIF")) .getImage()); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(); } }); pnlMain.setLayout(new java.awt.BorderLayout()); getContentPane().add(pnlMain, java.awt.BorderLayout.CENTER); pack(); Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit(); java.awt.Dimension screenSize = toolkit.getScreenSize(); int screenResolution = toolkit.getScreenResolution(); float zoom = ((float) screenResolution) / net.sf.jasperreports.swing.JRViewerPanel.REPORT_RESOLUTION; int height = (int) (550 * zoom); if (height > screenSize.getHeight()) { height = (int) screenSize.getHeight(); } int width = (int) (750 * zoom); if (width > screenSize.getWidth()) { width = (int) screenSize.getWidth(); } java.awt.Dimension dimension = new java.awt.Dimension(width, height); setSize(dimension); setLocation((screenSize.width - width) / 2, (screenSize.height - height) / 2); }
From source file:vn.topmedia.monitor.form.MDIMain.java
/** * Creates new form MDIMain/*from w ww . j a v a 2 s . c o m*/ */ public MDIMain() { initComponents(); initConfigure(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); this.setSize((int) d.getWidth(), (int) d.getHeight()); }
From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java
public JFRoomPayment(final JFRoom jfRoom) { this.jfRoom = jfRoom; this.invoiceController = new InvoiceController(); invoiceStatusController = new InvoiceStatusController(); invoiceItemController = new InvoiceItemController(); roomStatusController = new RoomStatusController(); this.roomStatusEnabled = roomStatusController.selectEnabled(); this.statusBillToCompany = invoiceStatusController.selectBillToCompany(); this.initComponents(); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((int) (screenSize.getWidth() / 2 - 350), (int) (screenSize.getHeight() / 2 - 350)); this.setModal(true); this.setInvoiceStatusModel(); this.jcbAccountState.setEnabled(false); }