Help with image editing

i have written this code for changing the brightness of the image.....but the problem is that when i use the slider the change is not taking effect.....it works if i click on the radio button...
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.color.ColorSpace;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.BoundedRangeModel;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.image.*;
import javax.swing.*;
import java.awt.color.ColorSpace;
import javax.swing.border.TitledBorder;
public class ImageColorEffect extends JFrame implements ActionListener {
DisplayPanel displayPanel;
JRadioButton brightButton, darkButton, contrastIButton, contrastDButton,
reverseButton, changeButton, resetButton;
public ImageColorEffect() {
super("Color Effect Example");
Container container = getContentPane();
displayPanel = new DisplayPanel();
container.add(displayPanel);
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(2, 10));
ButtonGroup group = new ButtonGroup();
brightButton = new JRadioButton("Brightness",false);
panel.add(brightButton);
group.add(brightButton);
brightButton.addActionListener(this);
JSlider aJSlider = new JSlider(JSlider.HORIZONTAL);
container.add(aJSlider, BorderLayout.SOUTH);
ChangeListener aChangeListener = new BoundedChangeListener();
BoundedRangeModel model = aJSlider.getModel();
model.addChangeListener(aChangeListener);
aJSlider.addChangeListener(aChangeListener);
// System.out.println( "valueee="+value);
container.add(BorderLayout.NORTH, panel);
addWindowListener(new WindowEventHandler());
setSize(displayPanel.getWidth(), displayPanel.getHeight() + 50);
show();
class WindowEventHandler extends WindowAdapter {
public void windowClosing(WindowEvent e) {
System.exit(0);
public static void main(String arg[]) {
new ImageColorEffect();
public void actionPerformed(ActionEvent e) {
JRadioButton rbutton = (JRadioButton) e.getSource();
if (rbutton.equals(brightButton)) {
displayPanel.brightenLUT(500);
displayPanel.applyFilter();
displayPanel.repaint();
class DisplayPanel extends JPanel {
Image disImage;
BufferedImage image;
Graphics2D graph;
LookupTable lookup;
DisplayPanel() {
setBackground(Color.black);
loadImage();
setSize(disImage.getWidth(this), disImage.getWidth(this));
createBufferedImage();
public void loadImage() {
disImage = Toolkit.getDefaultToolkit().getImage("1.jpg");
MediaTracker media = new MediaTracker(this);
media.addImage(disImage, 1);
try {
media.waitForAll();
} catch (Exception e) {}
if (disImage.getWidth(this) == -1) {
System.out.println("file not found");
System.exit(0);
public void createBufferedImage() {
image = new BufferedImage(disImage.getWidth(this), disImage
.getHeight(this), BufferedImage.TYPE_INT_ARGB);
graph = image.createGraphics();
graph.drawImage(disImage, 0, 0, this);
public void brightenLUT(int value)
System.out.println(" The brightness amount : "+value);
short brighten[] = new short[256];
for (int i = 0; i < 256; i++)
//System.out.println(i);
short pixelValue = (short) (i+value);
if (pixelValue > 255)
pixelValue = 255;
else if (pixelValue < 0)
pixelValue = 0;
brighten[i] = pixelValue;
lookup = new ShortLookupTable(0, brighten);
applyFilter();
repaint();
public void applyFilter() {
LookupOp lop = new LookupOp(lookup, null);
lop.filter(image, image);
public void update(Graphics g) {
g.clearRect(0, 0, getWidth(), getHeight());
paintComponent(g);
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2D = (Graphics2D) g;
g2D.drawImage(image, 0, 0, this);
//repaint();
/////// The slider control
class BoundedChangeListener extends DisplayPanel implements ChangeListener
public void stateChanged(ChangeEvent changeEvent)
Object source = changeEvent.getSource();
if (source instanceof BoundedRangeModel)
BoundedRangeModel aModel = (BoundedRangeModel) source;
if (!aModel.getValueIsAdjusting())
DisplayPanel d=new DisplayPanel();
brightenLUT(aModel.getValue()) ;
System.out.println("Changed value: " + aModel.getValue());
}}

found the soln maself....
jus the displaypanel object had to be used to call the func.
and had to place the othr funcs in teh ImageColorEffect class!
wohoo!
//CODE
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.color.ColorSpace;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.BoundedRangeModel;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.image.*;
import javax.swing.*;
import java.awt.color.ColorSpace;
import javax.swing.border.TitledBorder;
public class ImageColorEffect extends JFrame implements ActionListener {
DisplayPanel displayPanel;
JRadioButton brightButton, darkButton, contrastIButton, contrastDButton,
reverseButton, changeButton, resetButton;
public ImageColorEffect() {
super("Color Effect Example");
Container container = getContentPane();
displayPanel = new DisplayPanel();
container.add(displayPanel);
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(2, 10));
ButtonGroup group = new ButtonGroup();
brightButton = new JRadioButton("Brightness",false);
panel.add(brightButton);
group.add(brightButton);
brightButton.addActionListener(this);
JSlider aJSlider = new JSlider(JSlider.HORIZONTAL);
container.add(aJSlider, BorderLayout.SOUTH);
ChangeListener aChangeListener = new BoundedChangeListener();
BoundedRangeModel model = aJSlider.getModel();
model.addChangeListener(aChangeListener);
aJSlider.addChangeListener(aChangeListener);
// System.out.println( "valueee="+value);
container.add(BorderLayout.NORTH, panel);
addWindowListener(new WindowEventHandler());
setSize(displayPanel.getWidth(), displayPanel.getHeight() + 50);
show();
class WindowEventHandler extends WindowAdapter {
public void windowClosing(WindowEvent e) {
System.exit(0);
public static void main(String arg[]) {
new ImageColorEffect();
public void actionPerformed(ActionEvent e) {
JRadioButton rbutton = (JRadioButton) e.getSource();
if (rbutton.equals(brightButton)) {
displayPanel.brightenLUT(10);
displayPanel.applyFilter();
displayPanel.repaint();
class DisplayPanel extends JPanel {
Image disImage;
BufferedImage image;
Graphics2D graph;
LookupTable lookup;
DisplayPanel() {
setBackground(Color.black);
loadImage();
setSize(disImage.getWidth(this), disImage.getWidth(this));
createBufferedImage();
public void loadImage() {
disImage = Toolkit.getDefaultToolkit().getImage("1.jpg");
MediaTracker media = new MediaTracker(this);
media.addImage(disImage, 1);
try {
media.waitForAll();
} catch (Exception e) {}
if (disImage.getWidth(this) == -1) {
System.out.println("file not found");
System.exit(0);
public void createBufferedImage() {
image = new BufferedImage(disImage.getWidth(this), disImage
.getHeight(this), BufferedImage.TYPE_INT_ARGB);
graph = image.createGraphics();
graph.drawImage(disImage, 0, 0, this);
public void brightenLUT(int value)
System.out.println(" The brightness amount : "+value);
short brighten[] = new short[256];
short pixelValue;
for (int i = 0; i < 256; i++)
//System.out.println(i);
pixelValue = (short) (i+value);
if (pixelValue > 255)
pixelValue = 255;
else if (pixelValue < 0)
pixelValue = 0;
brighten[i] = pixelValue;
for (int i = 0; i < 256; i++){
System.out.print(brighten[i]+" ");
lookup = new ShortLookupTable(0, brighten);
public void applyFilter() {
//System.out.print("hajdfh");
LookupOp lop = new LookupOp(lookup, null);
lop.filter(image, image);
public void update(Graphics g) {
g.clearRect(0, 0, getWidth(), getHeight());
paintComponent(g);
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2D = (Graphics2D) g;
g2D.drawImage(image, 0, 0, this);
//repaint();
class BoundedChangeListener extends DisplayPanel implements ChangeListener
public void stateChanged(ChangeEvent changeEvent)
Object source = changeEvent.getSource();
if (source instanceof BoundedRangeModel)
BoundedRangeModel aModel = (BoundedRangeModel) source;
if (!aModel.getValueIsAdjusting())
displayPanel.brightenLUT(aModel.getValue()) ;
displayPanel.applyFilter();
displayPanel.repaint();
System.out.println("\nChanged value: " + aModel.getValue());
}

Similar Messages

  • Help with image ready on ps3 extended

    I am pretty new to photo shop and have cs3 extended.
    I have a Yorkie website where I cut out my Yorkies and paste them to differnet backgrounds.... a lady that does the ANIMATED pictures  HAS DID A COUPLE FOR ME ....BUT I NEED TO LEARN TO DO THIS MYSELF.  She will not tell folks how to do:)
    The problem is once you work with a pic that is animated already then try to  add a dog.....by pasting....it removes the animation in the background pic.... and the picture no longer moves once the dog is added ?....She said she puts thru IMAGE READY...which I do not see anywhere on CS3 extended.  I will try to insert a pic she did for me and any help would be greatly appreciated....as I can do but then the picture is no longer animated once altered in my photoshop but she is doing somehow.....so has to be poss ?  If I were to do this pic it would stop moving once the dogs were added....plus not as good as her but practicing........could it be the fact she is doing in layers and I am doing copy and paste...I do know she puts thru Image ready and I do not know where this is located on cs3 extended or how to do?
    am

    well...........l when I try to open Gif with the import and chose the video frames to layers...am getting a message saying I need Quicktime 7.1 to be able to do??? and when selecting import that is the only option I have to open my animated picture?...YOU HAVE BEEN SO MUCH HELP!   THANK YOU SO MUCH...! 
       BLUE MONDAY EXCLUSIVES   
    Date: Sat, 17 Apr 2010 20:23:27 -0600
    From: [email protected]
    To: [email protected]
    Subject: Re: Help with image ready on ps3 extended
    I'm not sure anyone mentioned this but if not to open GIFs using the import you have to enter the GIF name as GIF isn't listed as one of the options.
    It sounds like you are viewing the images in a maximized screen mode. To view more than one document, press F to cycle through the screen modes. FYI, only the contents of the currently selected document can be viewed in the layers palette.
    I'll just talk about copy/paste so as not to confuse...
    If you are going to copy/paste, click the frame around the dog document to target it. Your layers palette will now contain the contents of the dog document. Click on the layer in the layers palette with the selected dog over transparency. With that layer highlighted in your layers palette, press Ctrl A; then Ctrl C. (Select<Select All; Edit<copy if you prefer using the menu.) This will copy that layer into your clipboard.
    Next, click the frame of the document containing the animation. Click the topmost layer in the layers palette because we want you dog to be in the top layer. Press Ctrl + V. (Edit<Paste if you prefer using the menu).
    Your dog is most likely going to be too big. Use Edit<Free Transform to size and move the dog to the desired location.
    At this point, your dog should be showing in each frame in the animation palette.
    Example:
    http://forums.adobe.com/servlet/JiveServlet/downloadImage/25315/with-palettes-open.jpg
    I'm using the older Image Ready me method. The highlighted place in the palette is where you switch methods between the old method and the new timeline. Notice, I have the layers and animation palette both in the workspace...and I'm not in a maximized mode. The red arrow shows the correlation between the frame and the layer represented by it in the layers palette.
    Image:second-image.jpg
    Here I have a second image to slip into my animation. I have the creature selected and on it's own layer with transparency around it. Notice that the the layer with the isolated creature is highlighted. At this stage, I'll press Ctrl + A; then Ctrl + C to select and save this image to my clipboard.
    Image:creature-added.jpg
    Here, I've pasted (Ctrl + V or Edit<Paste) in my creature and resized it (Ctrl + T or Edit<free transform) so he can be jumped. I also added a shadow under my creature which I added to a layer under my creature. Notice that when Frame on is selected in the animation palette that the eye is on both the creature and the shadow. If I click the eye to turn them (creature and shadow layer) off, they disappear from the entire animation. I can make them appear at any frame by clicking the desired frame in the animation then turning on the eye icon for the creature and shadow layer in the layers palette. I can also adjust opacity if desired.
    You could even more than the one image if you want the dog to appear to move. Use the eyeball visibility to determine which pose will be used for that frame.
    Example:
    Image:jump-creature-gif.gif
    Here, I used transform warp to adjust the pose of the creature for a few frames as he's jumping the creature...just for fun.
    >

  • I need help with Cool Edit 2000

    I need help with Cool Edit 2000. Can someone help me?

    Message edited by moderator: maybe don't publicly post your serial?
    Quite! Never a good idea, even with really old software...
    jackm36094786 wrote:
    Steve: What I have is a Serial # (?) xxx ID # 105368761 and a case # 3009176.I also have the program on my Gateway computer but I don't know how to use it.  Is this of any assistance?
    The program software should install fine (others report using it successfully) but the difficulty has always been registering it. To do this you need to find a program (that often people discard, unfortunately) called ce2kreg.exe and run that. That's where you enter your registration details, and how you get rid of all the noises that CE2000 will put all over your audio otherwise (unless you severely restrict the facilities you can use).
    It used to be the case that if you'd lost the registration program but had the serial numbers, that Adobe would send you a copy of ce2kreg.exe, but somehow I doubt that they'd be willing to do this any more - it was a long time ago now, after all.

  • Help with images in Spry menus

    I need help making this work: I want my menu buttons and
    submenu buttons to be images rather than text. I've been able to
    set it up to use different images for each of the main and
    sub-level buttons, but only for the active state. I cannot figure
    out how to use a different set of "hover images" for the hover
    state. Note-- Each button and submenu button in the entire menu are
    different images, so I suspect I need to use different ID's for
    each, but I am not sure how to set that up in the
    SpryMenuBarHorizontal.css file for each different button in, at
    least, the active and hover states. Can anyone offer some help with
    this?:

    V1 - Thank you for the suggestion, but this does not exactly
    solve my dilemma. In its simplest terms, this is what I want to do:
    Create a single drop-down menu where there is "Item 1" with
    submenus "Item 1.1", "Item 1.2", and "Item 1.3". But, I want to use
    different images for each item and subitem in their Active and
    Hover states. So, in this example, there would be 8 different
    images... An Active and a Hover image for each of Item 1, Item 1.1,
    Item 1.2 and Item 1.3.

  • [CS3][JS] Help with image resizing

    I'm still a newbie of ID scripting.
    I'm using js scripting in Indesign CS3 to make an auto-impaginator and I have a problem with images.
    I charged my contents from an xml set of tables, that I put into a fixed textFrame of the master page.
    Because of the table needs to fill multiple pages, I made a function that keep creating pages and link the textFrames so that the table continues in various pages.
    In this whole process I have some images too, that I need to resize them to fill the cell, because now they pass the parent cell.
    I found a method that looks at the bounds and resizes the image and the rectangle too, but it doesn't work always, because if a image is overflowing, it hasn't any bound and it fails, and this causes other problems in my process, so I would find another method.
    So:
    Is there another way to resize an image on-the-way while importing it? Some xml attribute or preference?
    Or some method that works also if the image is overflowing?

    These forums are pointless. Adobe must believe that other users will cut the mustard. Absolutely a waste of effort for everyone. Adobe should PAY at least a junior developer involved in the projects to monitor and help with these posts. FLEX rules yeah and thousands more do scripting than develop plug ins...
    Come on Adobe, step up your better than this. Customer Service can be free to the customers ... we are not talking about GET IT ALL FREE, talking about buy it and create a community and support it, but then again LAYERS and INDESIGN SECRETS have people who actually want to help users rather than rabbit hole everything.
    Please join hands and SING...

  • Urgent Help with Image Gallery

    Hi,
    I really need help with an image gallery i have created. Cannot think of a resolution
    So....I have a dynamic image gallery that pulls the pics into a movie clip and adds them to the container (slider)
    The issue i am having is that when i click on this i am essentially clicking on all the items collectively and i would like to be able to click on each image seperately...
    Please see code below
    var xml:XML;
    var images:Array = new Array();
    var totalImages:Number;
    var nbDisplayed:Number = 1;
    var imagesLoaded:int = 0;
    var slideTo:Number = 0;
    var imageWidth = 150;
    var titles:Array = new Array();
    var container_mc:MovieClip = new MovieClip();
    slider_mc.addChild(container_mc);
    container_mc.mask = slider_mc.mask_mc;
    function loadXML(file:String):void{
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(new URLRequest(file));
    xmlLoader.addEventListener(Event.COMPLETE, parseXML);
    function parseXML(e:Event):void{
    xml = new XML(e.target.data);
    totalImages = xml.children().length();
    loadImages();
    function loadImages():void{
    for(var i:int = 0; i<totalImages; i++){
      var loader:Loader = new Loader();
      loader.load(new URLRequest("images/"+String(xml.children()[i].@brand)));
      images.push(loader);
    //      loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onProgress);
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
    function onComplete(e:Event):void{
    imagesLoaded++;
    if(imagesLoaded == totalImages){
      createImages();
    function createImages():void{
    for(var i:int = 0; i < images.length; i++){
      var bm:Bitmap = new Bitmap();
      bm = Bitmap(images[i].content);
      bm.smoothing = true;
      bm.x = i*170;
      container_mc.addChild(bm);
          var caption:textfile=new textfile();
          caption.x=i*170; // fix text positions (x,y) here
       caption.y=96;
          caption.tf.text=(xml.children()[i].@brandname)   
          container_mc.addChild(caption);

    yes, sorry i do wish to click on individual images but dont know how to code that
    as i mentioned i have 6 images that load into an array and then into a container and i think that maybe the problem is that i have the listener on the container so when i click on any image it gives the same results.
    what i would like is have code thats says
    if i click on image 1 then do this
    if i click on image 2 then do something different
    etc
    hope that makes sense
    thanks for you help!

  • Help with multiclip editing in FCP

    Can someone please help me with multiclip editing. I have followed all the steps in the tutorials I have watched but I am unalble to switch between the two angles in the time line. Also the red line in the time line is telling me to render everything first . Is that normal or is it because I am using the 5.0 version of FCP?

    To switch between angles, the timeline should not be rendered. Once you render it, it may play more smoothly, but you can't switch.
    Also, sometimes you may have trouble switching many HD files, so it might work better to use Media Manager to make lower resolution proxies for your editing, then bringing the full-res files back for your final output. If the computer can't handle the load, it may refuse to do multiclip editing.
    Finally, you may need to switch Playhead Sync back to "Open" from time to time. For some reason, the Viewer sometimes switches to "Sync Off".
    By the way, your question actually belongs on the Final Cut Studio forum:
    https://discussions.apple.com/community/professional_applications/final_cut_stud io

  • Help with images not loading

    My Flash page is supposed to load images from Photobucket.
    However, the images are not loading. I've checked two things to see
    if they have an effect:
    1) Whether Photobucket has a policy file (crossdomain.xml) to
    allow external access. It does.
    2) Changing the allowScriptAccess parameter to "always".
    Here's the HTML page where the Flash file is being used:
    http://www.geocities.com/mikehorvath.geo/legopanotour.htm
    The page works fine on my harddrive. I'd appreciate any help.
    -Mike
    [edit]
    Duh! I didn't properly understand the purpose of policy
    files. The domain of my own site's server needs to be listed in
    Photobucket's policy file. Please ignore this message.

    same damn problem I am probably having...When using IE and
    deleting temporary internat files it disables/corrupts/removes
    proper function of the adobe flash player....You can reinstall all
    night long and it will claim a "successful" installation but, it is
    not....YOU MUST FIRST UNINSTALL ADOBE FLASH PLAYER USING THE ONLY
    TOOL THAT WILL DO THIS WHICH IS THE FLASH PLAYER UNINSTALLER FROM
    THE ADOBE WEBSITE....BE SURE AND SAVE IT BECAUSE YOU WILL BE USING
    IT FOREVER.....Once you have used the uninstaller program you can
    then sucessfully and truthfully download the latest adobe flash
    player.......WILL SOMEBODY FROM ADOBE FIX THIS!........
    Adobe
    Uninstaller at bottom of page

  • Help with images.....pliiiizzzzzz

    Im new to java and need help inserting images on a GUI! Does anyone have any programs or snippets of code that've done this successfully - preferrably using the GridBagLayout as well as in swing? If you have anything that works well, feel free to send me the entire java file ([email protected]) or just post it!

    Just create a JLabel with an image icon and you are able to display any JPEG and GIF image. You might take a look at the following:
    http://java.sun.com/docs/books/tutorial/uiswing/components/label.html
    Hope this helps,
    Pierre

  • Help with image viewer

    Would love some help with this one.. I am new so please bare with me. This app just reads contents of a txt file. What I am trying to add is the ability to display an image inside the program frame with scrolls bars.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Viewer extends JFrame
       private JMenuBar menuBar;
       private JMenu fileMenu;
       private JMenu fontMenu;
       private JMenuItem newItem;
       private JMenuItem openItem;
       private JMenuItem saveItem;
       private JMenuItem saveAsItem;
       private JMenuItem exitItem;
       private JRadioButtonMenuItem monoItem;
       private JRadioButtonMenuItem serifItem;
       private JRadioButtonMenuItem sansSerifItem;
       private JCheckBoxMenuItem italicItem;
       private JCheckBoxMenuItem boldItem;
       private String filename;
       private JTextArea editorText;
         private JLabel label;
       private final int NUM_LINES = 20;
       private final int NUM_CHARS = 40;
       public Viewer()
          setTitle("Viewer");
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          editorText = new JTextArea(NUM_LINES, NUM_CHARS);
          editorText.setLineWrap(true);
          editorText.setWrapStyleWord(true);
          JScrollPane scrollPane = new JScrollPane(editorText);
          add(scrollPane);
          buildMenuBar();
          pack();
          setVisible(true);
       private void buildMenuBar()
          buildFileMenu();
          buildFontMenu();
          menuBar = new JMenuBar();
          menuBar.add(fileMenu);
          menuBar.add(fontMenu);
          setJMenuBar(menuBar);
       private void buildFileMenu()
          newItem = new JMenuItem("New");
          newItem.setMnemonic(KeyEvent.VK_N);
          newItem.addActionListener(new NewListener());
          openItem = new JMenuItem("Open");
          openItem.setMnemonic(KeyEvent.VK_O);
          openItem.addActionListener(new OpenListener());
          saveItem = new JMenuItem("Save");
          saveItem.setMnemonic(KeyEvent.VK_S);
          saveItem.addActionListener(new SaveListener());
          saveAsItem = new JMenuItem("Save As");
          saveAsItem.setMnemonic(KeyEvent.VK_A);
          saveAsItem.addActionListener(new SaveListener());
          exitItem = new JMenuItem("Exit");
          exitItem.setMnemonic(KeyEvent.VK_X);
          exitItem.addActionListener(new ExitListener());
          fileMenu = new JMenu("File");
          fileMenu.setMnemonic(KeyEvent.VK_F);
          fileMenu.add(newItem);
          fileMenu.add(openItem);
          fileMenu.addSeparator();
          fileMenu.add(saveItem);
          fileMenu.add(saveAsItem);
          fileMenu.addSeparator();
          fileMenu.add(exitItem);
       private void buildFontMenu()
          monoItem = new JRadioButtonMenuItem("Monospaced");
          monoItem.addActionListener(new FontListener());
          serifItem = new JRadioButtonMenuItem("Serif");
          serifItem.addActionListener(new FontListener());
          sansSerifItem =
                  new JRadioButtonMenuItem("SansSerif", true);
          sansSerifItem.addActionListener(new FontListener());
          ButtonGroup group = new ButtonGroup();
          group.add(monoItem);
          group.add(serifItem);
          group.add(sansSerifItem);
          italicItem = new JCheckBoxMenuItem("Italic");
          italicItem.addActionListener(new FontListener());
          boldItem = new JCheckBoxMenuItem("Bold");
          boldItem.addActionListener(new FontListener());
          fontMenu = new JMenu("Font");
          fontMenu.setMnemonic(KeyEvent.VK_T);
          fontMenu.add(monoItem);
          fontMenu.add(serifItem);
          fontMenu.add(sansSerifItem);
          fontMenu.addSeparator();
          fontMenu.add(italicItem);
          fontMenu.add(boldItem);
       private class NewListener implements ActionListener
          public void actionPerformed(ActionEvent e)
             editorText.setText("");
             filename = null;
       private class OpenListener implements ActionListener
          public void actionPerformed(ActionEvent e)
             int chooserStatus;
             JFileChooser chooser = new JFileChooser();
             chooserStatus = chooser.showOpenDialog(null);
             if (chooserStatus == JFileChooser.APPROVE_OPTION)
                File selectedFile = chooser.getSelectedFile();
                filename = selectedFile.getPath();
                if (!openFile(filename))
                   JOptionPane.showMessageDialog(null,
                                    "Error reading " +
                                    filename, "Error",
                                    JOptionPane.ERROR_MESSAGE);
          private boolean openFile(String filename)
             boolean success;
             String inputLine, editorString = "";
             FileReader freader;
             BufferedReader inputFile;
                   label = new JLabel();
                    add(label);
             try
                freader = new FileReader(filename);
                inputFile = new BufferedReader(freader);
                inputLine = inputFile.readLine();
                while (inputLine != null)
                   editorString = editorString +
                                  inputLine + "\n";
                   inputLine = inputFile.readLine();
                editorText.setText(editorString);
                inputFile.close(); 
                success = true;
             catch (IOException e)
                success = false;
             return success;
       private class SaveListener implements ActionListener
          public void actionPerformed(ActionEvent e)
             int chooserStatus;
             if (e.getActionCommand() == "Save As" ||
                 filename == null)
                JFileChooser chooser = new JFileChooser();
                chooserStatus = chooser.showSaveDialog(null);
                if (chooserStatus == JFileChooser.APPROVE_OPTION)
                   File selectedFile =
                                 chooser.getSelectedFile();
                   filename = selectedFile.getPath();
             if (!saveFile(filename))
                JOptionPane.showMessageDialog(null,
                                   "Error saving " +
                                   filename,
                                   "Error",
                                   JOptionPane.ERROR_MESSAGE);
          private boolean saveFile(String filename)
             boolean success;
             String editorString;
             FileWriter fwriter;
             PrintWriter outputFile;
             try
                fwriter = new FileWriter(filename);
                outputFile = new PrintWriter(fwriter);
                editorString = editorText.getText();
                outputFile.print(editorString);
                outputFile.close();
                success = true;
             catch (IOException e)
                 success = false;
             return success;
       private class ExitListener implements ActionListener
          public void actionPerformed(ActionEvent e)
             System.exit(0);
       private class FontListener implements ActionListener
          public void actionPerformed(ActionEvent e)
             Font textFont = editorText.getFont();
             String fontName = textFont.getName();
             int fontSize = textFont.getSize();
             int fontStyle = Font.PLAIN;
             if (monoItem.isSelected())
                fontName = "Monospaced";
             else if (serifItem.isSelected())
                fontName = "Serif";
             else if (sansSerifItem.isSelected())
                fontName = "SansSerif";
             if (italicItem.isSelected())
                fontStyle += Font.ITALIC;
             if (boldItem.isSelected())
                fontStyle += Font.BOLD;
             editorText.setFont(new Font(fontName,
                                    fontStyle, fontSize));
       public static void main(String[] args)
          Viewer ve = new Viewer();
    }I tried using JLabel() but I cant seem to make it work. Whenever i browse and select a .jpg it displays "�������t���o\�[��+�p��B3�+�p��B3�"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    In the future, Swing related questions should be posted in the Swing forum.
    Whenever i browse and select a .jpg it displays "�������t���o\�[��+�p��B3�+�p��B3�" You can read in a jpg file and treat it like a text file.
    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html]How to Use Icons for the proper way to read images.

  • Help with Images Maps,

    Hi,
    I have an HTML page where an IMG is loaded:
    <img src="images/renders/Main_Image.jpeg" alt="Main Image" name="Main_IMG" width="800" height="600" border="0" usemap="#Main_MAP" id="Main_IMG" />
    Then I have 4 images maps laid on top of the image:
    <map name="Main_MAP" id="Main_MAP">
      <area shape="poly" coords="--some numbers--" href="Area1.html" target="_parent" alt="Area1 Button" />
      <area shape="poly" coords="--some numbers--" href="Area2.html" target="_parent" alt="Area2 Button"  />
      <area shape="poly" coords="--some numbers--" href="Area3.html" target="_parent" alt="Area3 Button" />
      <area shape="poly" coords="--some numbers" href="Area4.html" target="_parent" alt="Area4 Button"/>
    </map>
    See Example:
    Each area is essentially an invisible button. I want to make it so when the mouse hovers over the areas, I want the background image to display something different. On mouse out of the area, I want the image to go back. When the user clicks the Area, the user is moved to another part of the site.
    Area 1 should change Main_Image.jpeg to Main_Image1.jpeg
    Area 2 should change Main_Image.jpeg to Main_Image2.jpeg
    etc.
    I thought I could do this with Images Maps, but I can't figure out how. Is there an easier way? I have Dreamweaver CS4.
    Thank you in advance!

    Hey CF. Thank you very much for the reply! I thought I was losing my mind trying to figure out a way.
    I'll try out the slice and dice approach... where's a turtle when you need one.
    Cheers Dude.
    S

  • Need some help with Image Processor

    Hi there,
    I have alot of images i need to resize for a website. These images are all different sizes, from 250x400(h) to 200x800(h). I need these ALL to fit in a 246x327 canvas, in their original proportions, regardless of white space.
    Does anybody know if this is possible? So far all my results have failed and the image processor just seems to resize in proportion up to a maximum of 246x327, so nothing is that EXACT size, but all images will fit now fit INTO 246x327. I'm just not sure what to do now.
    Any help is greatly appreciated.
    - Tim

    You can do this with a script.
    Save the code into the presets/scripts folder as filename.jsx you can then include the script in an action. Use "Insert Menu Item" from the action pallete fly-out menu and select File - Scripts - select the script.
    function main(){
    if(!documents.length) return;
    var doc = activeDocument;
    var White = new SolidColor();
    White.rgb.hexValue = 'ffffff';
    // target size =  246x327
    FitImage(240, 321 ); //width - height change to suit
    app.backgroundColor = White;
    doc.resizeCanvas(new UnitValue(246,"px"), new UnitValue(327,"px"), AnchorPosition.MIDDLECENTER);
    main();
    function FitImage( inWidth, inHeight ) {
    var desc = new ActionDescriptor();
    var unitPixels = charIDToTypeID( '#Pxl' );
    desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
    desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
    var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
    executeAction( runtimeEventID, desc, DialogModes.NO );
    Edit:-
    You don't even need the script! as the size isn't dependant on orientation so after the Fit Image you can use Image - Canvas Size in your action.

  • Need help with image

    I sure could use a buddy who has Skype or something who I can shoot questions like this to.  My designer wants a retainer of $3,000 but I can do most of my own stuff in Photoshop.  Sometimes I get stumped though, and just need a 30 second tutorial. So I am coming here. 
    I basically need to figure out how to change this image:
    But along with that comes figuring out how to change it from a square image to one with a rounded top and bottom-right corner.   Also a 2 pixel shadow going up the right side and along the bottom.  I can manually draw in those two pixels easily enough.  But the corners look terrible when I try to manually do it.
    Is there an easier way?  I have been cropping the new image to the proper size, and then drawing in the two pixel fade on the side and bottom.  Then trying to pixel by pixel create the rounded edges.
    Its not looking natural. 
    Before you say "Its a drop shadow!" please remember, in order for me to copy that exact drop shadow, I would need to know all their settings, colors, pixel widths, etc.  All I have is a flat, finished image, so I have none of that information.  Plus, I dont know how to do a drop shadow on a curved corner, which deletes the original squared corner on the image.  :-\
    If you give instructions, please be as clear and detailed as possible. This is why I prefer a chat medium for this type of thing. 
    Thanks much to anyone who can assist.
    PB          

    Here is a TUTORIAL on doing rounded corners.  Hope it helps.   Could not get insert link to work so try this.  http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDYQFjAA&url=http%3A%2 F%2Fmatthom.com%2Farchive%2F2004%2F09%2F10%2Ffast-rounded-corners-in-photoshop&ei=q2l8T_T8 LcKZiQKQnt3uDQ&usg=AFQjCNEsGI12k8Ck-GiuIWMUOLC6m3xoYw
    Don't know what magnification you are using on this image, but the fact you have pixels shows it will be difficult to make a nice rounded edge.
    You might need a higher resolution image, or at least convert from 8 bits to 16 bits to do edits, then change back to 8 RGB to save.  Beware not all toolsand saves will work in 16 bit.

  • Help with graphic editing

    I think I have gotten myself in over my head. I am using the
    FreeHand software, & I know absolutely NOTHING about graphic
    design or this program. So, I'm hoping that someone with some
    patience can help me out. I have downloaded a vector image & am
    trying to edit it. The picture is of a flower. I basically only
    need to change the background color & to change the overall
    color of the flower. I have no idea where to begin. Any help?
    Thanks!!!

    Even though you have downloaded a vector illustration if it
    was saved as
    an EPS and brought into FH then it may or not be editable at
    that point.
    If it looks and acts like one piece of artwork (cannot
    select
    separate parts of it) and you cannot "Ungroup" it (Select art
    > Edit >
    Ungroup) then you are probably dealing with an EPS that FH
    cannot edit.
    Go to the Object Inspector and see what it says it is at the
    top of
    the panel when the artwork is selected. If it says Group or
    Path or
    Compound Path then you can edit. If it says EPS then you
    can't edit.
    You will need to crack it by using Illustrator or Distilling
    to PDF. If
    you are on a Mac you can open the EPS into the application
    Preview and
    it will make it a PDF. Then save it as a PDF from Preview and
    open in
    FreeHand.
    Good Luck,
    Rich
    Dani0628 wrote:
    > I think I have gotten myself in over my head. I am using
    the FreeHand
    > software, & I know absolutely NOTHING about graphic
    design or this program. So,
    > I'm hoping that someone with some patience can help me
    out. I have downloaded
    > a vector image & am trying to edit it. The picture
    is of a flower. I
    > basically only need to change the background color &
    to change the overall
    > color of the flower. I have no idea where to begin. Any
    help? Thanks!!!
    >

  • Help with Image format

    I have some graphics that were created in Photoshop with an
    alpha channel for transparency and I need to insert them in my
    Captivate project. What file format should I use to insert them in
    Captivate? (Or perhaps the question is, CAN they be inserted in
    Captivate?)
    Thank you in advance!

    Hi again
    Admittedly you have me on that one! I'm no graphics expert. I
    know probably enough to be dangerous.
    I'd suggest trying a 32 bit image and see. At the worst, it
    won't render very well or possibly it will reject it outright. You
    may need to adjust the image quality settings for a higher quality.
    You do this in two places.
    1. Edit slide properties and click the Quality drop-down.
    There you may choose between Standard, Optimized, JPEG or High
    Quality.
    2. Edit Project Preferences by clicking Project >
    Preferences... > Preferences tab. There you may configure JPEG
    image quality.
    Please do report back with what you discover regarding "32
    bit quality" so we all may learn.
    Hope this helps... Rick

Maybe you are looking for

  • Security Update 2012-004 breakes my WGM in 10.6.8

    Hi at all, i'm using 10.6.8. Today installed the Security-Update 2012-004. And now i can't use the Workgroup Manager (yes latest). After loggin to Server, the program crashes. Why i'm sure that it is the Security Update and nothing else? We have here

  • URGENT: Doubt in vendor replication

    hi,    i got an error i.e 1) <b>user sapuser is blocking organizational unit 50000xxx</b> 2) none of the purchasing org's in org, structure exist(inform system admin) while  iam replicating the vendor through in BBPGETVD pls send details imediatly to

  • Getting error "Document is locked by other user, please try again later"

    Hi Sap gurus, We have one invoice which is in approver's list. The approver is not able to neither approve this nor reject this invoice, the error message he gets is "Document is locked by other user, please try again lateru201D.  We have checked SM1

  • How do I get around the close IE message

    I keep getting a message saying to close IE when I am tryg to install Flash.  The only window I have open is the installer window. How do I get arond this message and get Flash to install?

  • HT5470 where is my 4 digit number regarding the volume

    the ipod ask me for a four digit code and I don't see what number to put in