/** * Creates an icon from an image contained in the "images" directory. * * @param filename * @return the ImageIcon created */ public static ImageIcon createImageIcon(String filename) { ImageIcon icon = null; URL imgURL = getImageURL(filename); if (imgURL != null) { icon = new ImageIcon(imgURL); } return icon; }
/** * Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code> in a grid. Each * component in a column is as wide as the maximum preferred width of the components in that column; height is * similarly determined for each row. The parent is made just big enough to fit them all. * * @param parent * * @param rows * number of rows * @param cols * number of columns */ public static void makeSpringCompactGrid(Container parent, int rows, int cols) { makeSpringCompactGrid(parent, rows, cols, PAD, PAD, PAD, PAD); }
/** * @param rowWeights * @param columnWeights */ public void layout(double[] rowWeights, double[] columnWeights) { SwingUtil.layoutToGrid(this.contentPanel, rowWeights, columnWeights); }
Spring width = Spring.constant(0); for (int r = 0; r < rows; r++) { width = Spring.max(width, getConstraintsForCell(r, c, parent, cols).getWidth()); SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setX(x); constraints.setWidth(width); Spring height = Spring.constant(0); for (int c = 0; c < cols; c++) { height = Spring.max(height, getConstraintsForCell(r, c, parent, cols).getHeight()); SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setY(y); constraints.setHeight(height);
PAUSE_ICON = SwingUtil.createImageIcon(IMAGES_PAUSE_JPEG); PLAY_ICON = SwingUtil.createImageIcon(IMAGES_PLAY_JPEG); this.playAction = new AbstractAction(null, PAUSE_ICON) { this.stepAction = new AbstractAction(null, SwingUtil.createImageIcon(IMAGES_STEP_JPEG)) { this.stopAction = new AbstractAction(null, SwingUtil.createImageIcon(IMAGES_STOP_JPEG)) {
this.frame.setIconImage(SwingUtil.createImage("airavata-2.png"));
Spring width = Spring.constant(0); for (int r = 0; r < rows; r++) { width = Spring.max(width, getConstraintsForCell(r, c, parent, cols).getWidth()); SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setX(x); constraints.setWidth(width); Spring height = Spring.constant(0); for (int c = 0; c < cols; c++) { height = Spring.max(height, getConstraintsForCell(r, c, parent, cols).getHeight()); SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setY(y); constraints.setHeight(height);
renderer.setOpenIcon(SwingUtil.createImageIcon("opened.gif")); renderer.setClosedIcon(SwingUtil.createImageIcon("closed.gif")); renderer.setLeafIcon(SwingUtil.createImageIcon("leaf.gif")); } catch (RuntimeException e) { logger.warn("Failed to load image icons. " + "It will use the default icons instead.", e);
/** * Creates an icon from an image contained in the "images" directory. * * @param filename * @return the ImageIcon created */ public static ImageIcon createImageIcon(String filename) { ImageIcon icon = null; URL imgURL = getImageURL(filename); if (imgURL != null) { icon = new ImageIcon(imgURL); } return icon; }
/** * Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code> in a grid. Each * component in a column is as wide as the maximum preferred width of the components in that column; height is * similarly determined for each row. The parent is made just big enough to fit them all. * * @param parent * * @param rows * number of rows * @param cols * number of columns */ public static void makeSpringCompactGrid(Container parent, int rows, int cols) { makeSpringCompactGrid(parent, rows, cols, PAD, PAD, PAD, PAD); }
/** * @param rowWeights * @param columnWeights */ public void layout(List<Double> rowWeights, List<Double> columnWeights) { SwingUtil.layoutToGrid(this.contentPanel, rowWeights, columnWeights); }
/** * Creates an image from an image contained in the "images" directory. * * @param filename * @return the Image created */ public static Image createImage(String filename) { Image icon = null; URL imgURL = getImageURL(filename); if (imgURL != null) { icon = Toolkit.getDefaultToolkit().getImage(imgURL); } return icon; }
/** * Layouts the child components of a specified parent component using GridBagLayout. * * @param numRow * The number of rows * @param numColumn * The number of columns * @param weightedRow * The row to weight * @param weightedColumn * The column to weight */ public void layout(int numRow, int numColumn, int weightedRow, int weightedColumn) { SwingUtil.layoutToGrid(this.contentPanel, numRow, numColumn, weightedRow, weightedColumn); }
/** * Creates an image from an image contained in the "images" directory. * * @param filename * @return the Image created */ public static Image createImage(String filename) { Image icon = null; URL imgURL = getImageURL(filename); if (imgURL != null) { icon = Toolkit.getDefaultToolkit().getImage(imgURL); } return icon; }
private void init() { if (this.owner instanceof Frame) { this.dialog = new JDialog((Frame) this.owner); } else if (this.owner instanceof Dialog) { this.dialog = new JDialog((Dialog) this.owner); } else { // This should not happen. throw new WorkflowRuntimeException("The owner component was neither Frame or Dialog."); } this.dialog.setTitle(this.title); this.dialog.setModal(true); this.dialog.setResizable(true); Container contentPane = this.dialog.getContentPane(); int numRow = 0; if (this.description != null && this.description.length() > 0) { JLabel descriptionLabel = new JLabel("<html>" + this.description + "</html>"); contentPane.add(descriptionLabel); numRow++; } contentPane.add(this.mainPanel); numRow++; contentPane.add(this.buttonPanel); numRow++; SwingUtil.layoutToGrid(contentPane, numRow, 1, numRow - 2, 0); } }
buttonPanel.setBorder(BorderFactory.createEtchedBorder()); String imgLogoTag="";//"<img src=\""+SwingUtil.getImageURL("airavata-2.png").toString()+"\" class=\".centeredImage\" /><br>"; String imgHeadingTag="<div style=\"width:100%;margin-right:10px;margin-left:10px;margin-top:5px;\" ><img src=\""+SwingUtil.getImageURL("airavata-title-text.png").toString()+"\" class=\".centeredImage\" /></div><br>"; String projectNameText = "";//"<h1>" + XBayaConstants.PROJECT_NAME + "</h1>"; String message = "<html>"+ styles +"<body align=\"center\">" + "<div style=\"background-color:white;width:100%;margin-bottom:0px;\">"+projectNameText + imgHeadingTag+ imgLogoTag +"</div><br><h2>" +XBayaConstants.APPLICATION_NAME + "</h2>" + "Version: "