public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { JMenuItem item = (JMenuItem) e.getSource(); String name = item.getText(); Profile profile = profiles.getProfile(name); Component[] components = selectorPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component comp = components[i]; if (comp instanceof CPCheckBox) { CPCheckBox scb = (CPCheckBox) comp; String id = scb.element.id; boolean enb = profile.has(id); scb.setState(enb); } } } }
public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { JMenuItem item = (JMenuItem) e.getSource(); String name = item.getText(); if (name.equals("New...")) { name = JOptionPane.showInputDialog(selectorPanel, "Enter a name for the new profile."); } if ((name == null) || name.trim().equals("")) return; Profile profile = new Profile(name); Component[] components = selectorPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component comp = components[i]; if (comp instanceof CPCheckBox) { CPCheckBox scb = (CPCheckBox) comp; String id = scb.element.id; if (scb.isSelected()) profile.add(id); } } profiles.add(profile); } }
public static void main(String args[]) { try { ICC_Profile inProfile = ICC_Profile.getInstance("/System/Library/ColorSync/Profiles/AdobeRGB1998.icc"); ICC_Profile outProfile = ICC_Profile.getInstance("/Library/ColorSync/Profiles/CIE 1931 D50 Gamma 1.icm"); Profile cmsOutProfile = new Profile(outProfile); Profile cmsInProfile = new Profile(inProfile); BufferedImage inputImage = ImageIO.read(new File("/Stuff/Reference/small-q60-adobergb.TIF")); ShortInterleavedRaster inputRaster = (ShortInterleavedRaster) inputImage.getTile(0, 0); ColorSpace outCS = new ICC_ColorSpace(outProfile); ColorModel outCM = new ComponentColorModel(outCS, false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); ShortInterleavedRaster outputRaster = (ShortInterleavedRaster) outCM.createCompatibleWritableRaster(inputImage.getWidth(), inputImage.getHeight()); BufferedImage outputImage = new BufferedImage(outCM, outputRaster, false, null); Transform cmsTransform = new Transform( cmsInProfile, TYPE_RGB_16, cmsOutProfile, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); cmsTransform.doTransform(inputRaster, outputRaster); ImageIO.write(outputImage, "TIF", new File("/Stuff/small-q60-CIED65.TIF")); cmsTransform.dispose(); cmsOutProfile.dispose(); cmsInProfile.dispose(); // System.out.println("Profile: " + hProfile + ", " + ); } catch (IOException e) { e.printStackTrace(); } }
public void menuSelected(MenuEvent e) { Profile profilePage = new Profile("staff", docID, type); profilePage.setVisible(true); dispose(); }