I need help with my GUI Photo Album.

Hello! I'm still learning bits about GUI and I need some assistance to make my basic program work. I've searched the forums to look at past Photo Album projects; they didn't help much or maybe I'm overlooking some things. Every time I click the "Next" button the image doesn't change. It may be a simple task to solve, but I'm really stumped! Sorry if it's such a stupid thing to ask. Thanks in advance.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class PhotoAlbum extends JPanel {
    int i = 1;
    JFrame frame = new JFrame("Photo Album");
    JButton next = new JButton("Next");
    ImageIcon icon = new ImageIcon("../Images/" + i + ".jpg");
    JLabel picture = new JLabel(icon);
    ButtonListener buttonListener = new ButtonListener();
    public PhotoAlbum() {
        frame.setSize(700, 600);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(new BorderLayout(5,5));
        frame.getContentPane().add(picture, BorderLayout.CENTER);
        frame.getContentPane().add(next, BorderLayout.SOUTH);
        next.addActionListener(buttonListener);
        frame.setVisible(true);
    class ButtonListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            if(e.getSource() == next){
                ++i;
}

WafflesNSyrup wrote:
int i = 1;
ImageIcon icon = new ImageIcon("../Images/" + i + ".jpg");
++i;
So I understand that you originally thought incrementing (i) would somehow update (icon) since it uses (i) in an expression. But now you hopefully know this is not a magical expression language.
I bet you would have also thought that this:
int x = 1;
int y = 2;
int z = x + y;
x = 42;
y = 58;would have ended up with z having the value 100? It doesn't. It did the math once, when it executed the expression (x + y) and stored it in the variable (z). So z == 3, regardless of what happens to x or y after the fact.

Similar Messages

  • I need help with managing my Photo Albums on my iPhone.

    I did a lot of reading before trying to do this, and I guess I missed something. I made a folder called "angie's iPhone pictures" under "Pictures" folder in Windows Vista. Then, in the "angie's iPhone pictures" folder, I made 2 other folders. 1 called "my wallpapers" and 1 called "my pictures".
    After Syncing the pictures to my phone using iTunes, my Photo Album now looks like this on my iPhone:
    Camera Roll (3)
    Photo Library (17)
    my pictures (4)
    my wallpapers (13)
    First of all, there is only 1 picture in my Camera Roll, why does it say 3?
    Second, is there any way to remove the "Photo Library" from the Albums, or is that something we have to keep?
    If it's something we must keep, can we at least change the icon next to it so it's not the flower?
    Thanks.

    gingrbreadgurl wrote:
    First of all, there is only 1 picture in my Camera Roll, why does it say 3?
    This is a known issue that third party software like phoneview can fix.
    Second, is there any way to remove the "Photo Library" from the Albums, or is that something we have to keep?
    No. Your photos are not actually duplicated, this is just a pointer to the photos in the various albums you have synced.
    If it's something we must keep, can we at least change the icon next to it so it's not the flower?
    No.

  • Need help with iPhone 5 photo albums

    Hi everyone, new here and just got my iPhone 5 yesterday. I have been using apple products for quite some time now so nothing is really all that new too me and I understand a majority of its difficulties although I have reached a road block. Heres the problem:
    I have been using my iPod Touch to take photos for a while now and I just recently got the iPhone 5. So I hooked up my iPhone 5 and synced everything and it all went pretty smooth and the only thing wrong is that I have two albums under pictures on my iPhone that contain the exact same photos. They are all pictures that were taken on my iPod Touch that were transferred onto my PC and then I used the folder that contained those images to sync with my iPhone. Now when I sync the folder to my iPhone, there is a "Photo Library" album with 206 pictures then the "iPod" album (the name of the folder on my computer) which also contains the same 206. Any way I can get rid of one of them? I have tried and only succeeded in getting rid of both of the albums nad not just one. Thanks for any and all help! (screen capture of what I am talking about below)

    To support what King_Penguin has provided, here is a support document that describes the steps to take with a device in Recovery Mode. If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support

  • Need help with cannon RAW photos

    Please help- let my employee go and nearly 100 photos of my products were left on my hard drive, but I can not get them to open.  They are somehow jacked up (show a different icon than they did).  They have no previous version, and absolutely NOTHING I have tried to open them will work.  Would someone be willing to test one to see if they can figgure it out?  Or, has anyone fixed this problem before?

    You are a genius! Now that I understand that those are support
    files, and know what I am looking (at) and for- I found all the photos.
    She left us in quite a mess- both with the photos and our web page so
    thank you again for helping. Feel free to let me know if you need
    anything in the future. I won't forget your help!
    Cristi
    910 10th Street, Greeley, CO 80631
    P: 970-351-6398
    F:
    1-970-352-1085
    [email protected]
    facebook.com/AwardAlliance
    www.awardalliance.com
    Award Alliance is always doing cool
    things on our facebook! Come like us, and maybe see your awards featured
    there! (facebook.com/AwardAlliance)
    On 2013-09-26 19:35, ssprengel
    wrote:
    RE: NEED HELP WITH CANNON RAW PHOTOS
    created by
    ssprengel in Photoshop Lightroom - View the full discussion

  • Need help with backed up photos-now cannot view..?

    Using iphoto 6, super duper, seagate external hd. Drive has already been set-up and backed up several times-been working well........until.......
    Last night, I saw that out of 120gb I have about 5gb left on my G4.!
    "decided" to back-up iphotos and "delete" some on my G4 to reserve more space.
    Now, if I go to the external and click on pictures folder, I can see all of my originals folders (2002-2008), but when I open iphoto, they are not in iphoto.?
    On my G4, it's the same thing, but worse! When I tried to delete my photos, I was holding the apple key and selecting multiple items, then dragging them to the trash.......I'm sure you have done this yourself before, but It drug them a little, then them "dropped" into other places in the same folder-NOT the trash! They are in all different places in the pictures folder, and not in the same places they used to be......!!!
    I've read about "re-constructing" the library. Will this work? I do not want to do any more damage. They are there-I know it!
    So, I drug the entire library of "originals" back into iphoto, but ALMOST all of the way through (got down to 100 out of 8,000 photos) and got a message that says "an error occured while trying to save your iphoto library. Make sure you have enough hard disk space and that iphoto is able to access the iphoto library folder."
    I look at my hd space, and I have about 500mb left....?
    What does this mean? I THINK I don't have enough hd space to do it now. What the **** should I do? Getting a little frustrated at this point. I am off tomorrow and want to get it fixed up.
    8,000 of my childrens photos is nothing to "play" with. I can't believe I was so stupid with these. These mean the world to me, and I'm pretty sure they are still there. Obviously they are because about 60gb of hd space is being used up with my photos according to the program "what size?" I downloaded to use.
    Where to start?
    First, thanks for reading this, and second---could someone help me out some?
    Could someone please post a link to help me to correctly partition the seagate external hd, and get these photos backed up?
    Also, what is the best way to free up my hd space on my G4? I also have a mini with 60gb of storage if I need additional hd space. In addition, I have an iphone, itouch, imac, 3 nanos, ipod hi-fi,,,,,,,Obviously, I LOVE my Apple products, but don't have enough knowledge to operate them.....kinda sad, huh?

    This is the iPhoto '08 forum (version 7.x.x) and you may very well get incorrect answers to questions about other versions - it would be better to post in the iPhoto 6 forum - http://discussions.apple.com/forum.jspa?forumID=1116
    LN

  • Need help with a gui

    Here's my code:
    import java.awt.Dimension;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    public class xScriptGUI extends JPanel {
         private JLabel component1;
         private JLabel component2;
         private static JTextField component3;
         private static JPasswordField component4;
         private JButton component5;
         static String authUsername;
         static String authPassword;
         public xScriptGUI() {
              // construct components
              component1 = new JLabel("Username:");
              component2 = new JLabel("Password:");
              component3 = new JTextField(5);
              component4 = new JPasswordField(5);
              component5 = new JButton("Login");
              // adjust size and set layout
              setPreferredSize(new Dimension(234, 132));
              setLayout(null);
              // add components
              add(component1);
              add(component2);
              add(component3);
              add(component4);
              add(component5);
              // set component bounds (only needed by Absolute Positioning)
              component1.setBounds(25, 20, 100, 25);
              component2.setBounds(25, 50, 100, 25);
              component3.setBounds(95, 20, 100, 25);
              component4.setBounds(95, 50, 100, 25);
              component5.setBounds(65, 85, 100, 25);
         public static void main(String[] args) {
              JFrame frame = new JFrame("xScript Auth");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new xScriptGUI());
              frame.pack();
              frame.setVisible(true);
    }When Component5 is clicked, i would like it to do this:
              authUsername = component3.getText();
              authPassword = component4.getText();
              JOptionPane.showMessageDialog(frame, authUsername);
              JOptionPane.showMessageDialog(frame, authPassword);COuld you implement this into my script, as i'm having lots of difficulties.
    TIA,
    Chris

    Could you help me with this code, too?
    import java.awt.Dimension;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    public class xScriptGUI extends JPanel implements ActionListener {
      private JLabel component1;
      private JLabel component2;
      private static JTextField component3;
      private static JPasswordField component4;
      private JButton component5;
      static String authUsername;
      static String authPassword;
      public xScriptGUI() {
        // construct components
        component1 = new JLabel("Username:");
        component2 = new JLabel("Password:");
        component3 = new JTextField(5);
        component4 = new JPasswordField(5);
        component5 = new JButton("Login");
        component5.addActionListener(this);
        // adjust size and set layout
        setPreferredSize(new Dimension(234, 132));
        // why do people do this?
        // this is a very fragile GUI.
        setLayout(null);
        // add components
        add(component1);
        add(component2);
        add(component3);
        add(component4);
        add(component5);
        // set component bounds (only needed by Absolute Positioning)
        // (and will stuff up on the next machine, a different screen
        // resolution, a different OS, possibly the next Java version..)
        component1.setBounds(25, 20, 100, 25);
        component2.setBounds(25, 50, 100, 25);
        component3.setBounds(95, 20, 100, 25);
        component4.setBounds(95, 50, 100, 25);
        component5.setBounds(65, 85, 100, 25);
      public void actionPerformed(ActionEvent ae) {
        if (ae.getSource()==component5) {
          authUsername = component3.getText();
          // deprecated!
          // authPassword = component4.getText();
          authPassword = new String(component4.getPassword());
          // we have no convenient reference to the frame, so we
          // use the JPanel (which should be in the 'same' place)
          // instead
          JOptionPane.showMessageDialog(this, authUsername);
          JOptionPane.showMessageDialog(this, authPassword);
         URL url = new URL("http://auth.1337chris.org/xscripts/auth.php?user=" + URLEncoder.encode(authUsername, "UTF-8") + "&pass=" + URLEncoder.encode(authPassword, "UTF-8"));
         BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        url.openStream()));
         String inputLine;
         while ((inputLine = in.readLine()) != null)
              if (inputLine.equals("0")) {
                   JOptionPane.showMessageDialog(this, "Go buy an auth, kid");
              } else if (inputLine.equals("1")) {
                   JOptionPane.showMessageDialog(this, "AUTHED");
         in.close();
        } else {
          JOptionPane.showMessageDialog(this, "Unknown command!");
      public static void main(String[] args) {
        // this should use 'invokeLater'
        JFrame frame = new JFrame("xScript Auth");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new xScriptGUI());
        frame.pack();
        frame.setVisible(true);
    }

  • Can u please help with my huge Photo/Album/Folder Management Project?

    Thanks for looking and happy holidays.
    Using 1.5.2
    I had all my photos under one external Hard Drive and most were not keyworded. I also have a very large folder (recovered) that I had to recover
    lost images during a HD crash so they are simply in folders such as
    Recovered/Folder1 and recovered/folder2 and so on...
    Thus far....
    I imported all my folders as a project (Pictures-All) into Apeture as well as the "Recovered" folder sucessfully. Each folder came under this project as it was in my External HD.
    I did go into each "Recovered" folder and keyword the images, one by one.
    Now...
    What is the best way to organize this mess using Aperture to manage the entire library, i.e., all managed files, none referenced.
    And how should I handle the yet to be filed under a project "Recovered" folder.
    Should I do all this with Smart folders? If so, under a project? How?
    I'm thinking that Smart folders are vitural, so as long as I have all my imported images keyworded they will fall into the smart folder and from now
    on I keyword every single image. Am I on track?
    Being So greatful for any advice.
    Thanks
    Tom

    Hi Tom,
    Sounds like lots and lots of fun. More fun than you know what to do with!
    First thing I would do is sort on image date, just in case you have dups. .... unless you know you haven't. Create an album and drag all images (or batches of) from projects and recovered to the album. Sort on image date. Deleting any dups. from the album will delete the master/version image from its project also.
    Next I suggest you create a folder and project structure you desire.
    Then sort/filter your recovered project on keyword. Select the group needed and drag to its destination project. Dragging from project to project will move the master/version images.
    This should get you a long way down the path without too much fun (hopefully).
    G.

  • Wedding photography running out of space. Need help with thousands of photos, and workflow

    So my studio does wedding photography. Me and my partner both take photos.  We have about 30,000 photos just from the last 2 years.  We are running out of space big time. We both have 1 terabyte magnetic hard drives in our computers. I have about 80gb left and she has about 120gb left. Needless to say, since I myself take about 50gb of photos per wedding, I'm not going to last long. We use lightroom.
    So far I have managed to backup everything on an external 2TB hard drive for both of us. I save both RAW and Jpegs to it. I also have everything backed up on an online server.  So here's my first issue.  What I've been doing, is for the previous year (completed weddings) I delete all the RAWs from the computers. I leave the JPEG's on the computer incase I need them quickly. I keep all the RAWS on the external hard drives and online.  But even doing this, deleting the RAWs from completed weddings off the internal hard drives, I'm still almost out of space. My computer is so slow because of this even though it's a top of the line computer with 6 gigs of triple channel ram. Lightroom runs so very slow and lags so bad.
    So my first question is:  By deleting the raws off of my computer, if I need to go back a few years from now and re-save the raw files or re-edit, will lightroom remember my develop settings or will I have to completely re-edit every photo?  I have been saving a catalog file for each year, and start a new one every year.  I do not use XMP sidecar files I save everything to the lightroom database.  As long as I have the catalog file backed up, am I safe? Or am I doing this wrong? Because if open an old catalog file, it will say all the photos are not found on my computer (obviously).
    My second question is:  I am going to be investing in more hard drives and want to do it right this time around. I want to invest in SSD drives for maximum performance.  Here is what my plan is.  One SSD drive for windows/programs, one SSD drive for lightroom scratch disk, and one 1TB "Velociraptor" 10,000rpm magnetic hard drive for keeping the actual images on.  Is this not right? Am I planning this out wrong?
    Here is our current workflow. I am very welcome to suggestions:
    1) Shoot wedding.
    2) Import RAW files from CF card to computer. It goes in a folder for the client with the images going into different sub folders by category such as "reception" and "ceremony"
    3) Import folder into lightroom4.
    4) Edit photos. I do not use XMP sidecar, I use database.
    5) Export files in JPEG form into the same client folder.
    6) At the end of the year I save the catalog, make a new catalog for the new year. I delete the RAW files off of my hard drive after backing them up on 2TB external hard drive. I leave the jpegs and the client's folder on the computer hard drive.

    My guess is that you are not actually deleting the original raws from your internal hard drives and have lots and lots of crud around that you are not aware off so you should go through your internal drives with a fine-toothed comb. Don't forget to actually empty the trash when you delete! 1TB is more than enough disk space for storing the Lightroom catalog file, previews and some jpegs. 30.000 photos is really not that much. My main catalog  has >50.000 images in it with the raw files all stored on external hard drives. The catalog itself is on my internal 256 GB SSD HD that also houses the previews (so I can use it with the raw files offline) and the operating system as well as a lot of software (photoshop, office, iWorks, Aperture, etc.). It is more than enough space as it still has more than 150 GB free. I automatically back up everything, including the external HD that stores the raw images to separate external HDs stored in different places.

  • Need help with preloader for photo gallery

    Hello!
    I know I might be the 99999999991 to say that but I will say
    it...I'm a begginer with flash and I have a problem...:-)
    I'm building a photo gallery which loads jpg photos inside a
    loader component by using MovieClipLoader.
    Everything works just great but my only problem is that I
    can't scale the content (the jpg's) to the size of the loader
    component.
    I tryed everything but the photos are loading bigger then the
    loader, and I wnat to have the photos bigger then the loader so
    that I could have good quality on any resolution. Here's the
    actionscript I used, if it's necessary:
    //------------------MovieClip Loader---------\\
    var mcLoader:MovieClipLoader = new MovieClipLoader ();
    var myListener:Object = new Object ();
    mcLoader.addListener(myListener)
    myListener.onLoadProgress = function
    (target_mc,bytesLoaded,bytesTotal) {
    extLoader_mc._visible = true;
    var pctLoaded = Math.round(bytesLoaded/bytesTotal*100);
    extLoader_mc.extLoaderBar_mc._xscale = pctLoaded;
    extLoader_mc.extLoadinBarLines_mc._xscale = pctLoaded-1;
    extLoader_mc.pct_txt.text = pctLoaded;
    if (bytesLoaded >= bytesTotal) {
    extLoader_mc._visible = false;
    mcLoader.loadClip("pics/zernike1.jpg",picViewer_mc.picLoader);
    T
    Text
    Text

    first of all, you can't directly resize the bitmaps, you have to resize the movieclip above it. so if needed, create an empty movieclip inside another wrapper movie clip and resize the wrapper.
    then i noticed you don't have onLoadInit in your listener
    this method:
    myLIstener.onLoadInit=function(mc:MovieClip){
    will execute commands after the content is loaded. so you will have to resize your content after it's been loaded. you can't just resize something that you loaded above in your code, you have to wait until it's fully loaded
    anyways since you siad you are beginner i will list some useful tip for this job (i don't know if you already know them):
    this -refers to current movie clip
    this._parent -refers to parent movie cilp
    width and height of movie clips are controlled by _width and _height properties, not width height

  • Need help with scanning old photos

    Hi,
    I appologize in advance for the long post, but here it goes - I am an ultra newby and have been trying to figure out the best method of scanning and retouching. I have a new Epson V330 photo scanner and currently scan in 24-bit color at 300 dpi for most photos and 600 dpi for small photos like wallet size. I leave all the adjustment options OFF (unsharp mask, descreening, color resoration, backlight correction, dust removal) as I think that stuff should be done in photoshop. I save the scans as tiff files. In the tiff options box there is a checkbox that says "embed icc profile" although I don't know what profile it is embeding.
    I have recently been reading about color space and color profiles. I dug around in the setup for the epson and see that I could be scanning in 48 bid color (do I need that) and that there is a color configuration.  Currently it is set to "color control, continuous auto exposure. Display gamma: 2.2. Auto exposure level (right in the middle of low and high). The other options are ICM and no color correction.
    If I click on ICM, there is a source dropdown list, but the only thing there is "Epson standard". Then there is a target dropdown and the choices sRGB, Monitor RGB, Adobe RGB, Apple RGB, and ColorMatch RGB. There is then a check box that says "display preview using monitor compensation".
    If you are still reading this, what settings do you recommend I use?
    Thank you for your time.
    Brian

    If you are getting satisfactory results you may not need to change.
    For color, Epson will scan using its source profile.  Question is if and where best to make a conversion to other profiles such as AdobeRGB.  If you will be processing all your scans through Photoshop you can let Photoshop make this conversion to your Photoshop color working space when opening scan image file.
    If you won't be making tonal adjustments in Photoshop, probably 24-bit color will be sufficient (if you're satisfied with image appearance).  Likewise for auto exposure.  But if you find that you want to adjust the black or white points or tone curve then 48-bit may give you better results.  You can change mode to 24-bit RGB in Photoshop after you've made your adjustments.
    There are some functions that may better be performed closest to scanning by scan software.  Descreening is one, IME; although if you're scanning photo prints or transparencies you are not likely to need descreening.  You'll want to experiment with dust removal and sharpening to see what works best for your images.  Dust removal in particular you may find better-done by the scan software, particularly for transparencies (select Digital ICE).
    Another step to try: open your scan tiff in camera raw and apply nondestructive adjustments there before opening in Photoshop -- particularly sharpening and noise reduction.

  • Need help with Zen Micro Photo: It stays in recovery m

    Just recently, my zen micro photo has been staying in recovery mode. I have tried all of the four options available? to me in recovery mode. .) Clean up 2.) Formatt All 3.) Reload Firmware? 4.) Reboot. When I try "Reload Firmware". It doesn't really "reload". All it does is erase the current firmware, which it has done several times. My computer doesn't really realize the player. It doesn't allow me to acess my songs, which have already been deleted. It says the "Player is not connected". At first, I thought I needed to charge. I charged it to maximmum. The battery is "FULL". Also, the firmware update doesn't recognize the player either. Whenever I select the reboot option, my player reboots to recovery mode. This does no good, as I have tried all of the available options in recovery mode, and they have done no good. Your help would be greatly appreciated. Thank you.Message Edited by Damaniscool on 04-2-200707:29 PM

    do you hear a sound from the hard dri've like it's stuck? this is common. if so, please search this forum for "hard dri've whack" or "percussi've repair".

  • I need help with the GUI nad Graphic 2D....

    Hi
    i'm kind new to java and i have couple of questions... all my questions about the GUI...
    when i want to create a GUI programe , and when i want to draw a graphic with GUI, i do that way(code)
    "public class x1 extends JPanle{
         public void PaintComponent(Graphic g){
    My questions:
    1) why do i have to extend from JPanle ??
    2) Why do i use paintcomponent??? why i couldn't use directly 'Graphic g' ??
    This code i get it from the book, this is how it is done...
    Also, if i want to draw some shapes(rec, circle ..etc) and i want to put Button and organize them, how could i do that???
    i tried to organize the button after i draw the rectangle but i can't... all becaus of the stupid way'the code that i wrote it', i hope there is an alternative way.
    My last question... how can i change the font ???
    i want to use 'sans comic'...
    Thanks alot....

    kiiwii14 wrote:
    i'm kind new to java and i have couple of questions...fair enough.
    all my questions about the GUI...and that's your problem right there.
    Your questions tell me that you're missing quite a few fundamentals of programming in Java. There's nothing wrong with that, everyone starts this way. But if you try to do any GUI programming at your current level you will run head-first into many, many problems that could be easily avoided if you concentrate on learning the basics first.
    when i want to create a GUI programe , and when i want to draw a graphic with GUI, i do that way(code)
    "public class x1 extends JPanle{That code doesn't compile. It's JPanel, not JPanle. Please post only compiling code (or near it, if you've got a question about a compiler error).
         public void PaintComponent(Graphic g){"paintCompontent", not "PaintComponent".
    Oh, and in the future please use the CODE-Button when posting code (1. copy+paste code 2. select code 3. press "CODE" just above the text area).
    My questions:
    1) why do i have to extend from JPanle ??You don't have to. You can, if you want your class to be a specific type of JPanel.
    2) Why do i use paintcomponent??? why i couldn't use directly 'Graphic g' ??How would you "directly use Graphic g"?
    That's the way the framework is written. Components draw themselves using that method. If you want to change how they draw themselves you can override that method.
    Did you read the chapter that tells you this or did you simply copy out the code example? The examples are there to illustrate the points and help you understand. They are not a *substitute* to actually reading the text.
    Also, if i want to draw some shapes(rec, circle ..etc) and i want to put Button and organize them, how could i do that???Finish reading the book, write some basic programs and then work on from there.
    You're trying to learn a feature and produce a useful product at the same time. I can tell you from experience that this is a very bad idea.
    i tried to organize the button after i draw the rectangle but i can't... How did you try?
    all becaus of the stupid way'the code that i wrote it', i hope there is an alternative way.You didn't show us your attempt so we can't tell you any alternative.
    My last question... how can i change the font ???
    i want to use 'sans comic'... Hm ... "Comic Sans" is the name. And that's not a font. [It's a desease|http://bancomicsans.com/].

  • Need help with Java GUI

    I'm a bit unfamiliar with the features of the Java GUI which I'm using for an online game I'm making. Specifically, I can't move around the different components the way I want to. I want to have my game on one frame, but made up of 3 different parts. The top half will be the the actual game where the images are displayed, then below that will be a scroll pane to show all the messages the player has received, and the bottom part will be a text field so the player can send messages. I have the text field and scroll pane working, but the problem is that the scroll pane takes up the entire screen (except for the text field) and I can't find any way to resize it and move it to the bottom, just above the text screen, the way I want it to be. I'm using JTextField for the text field, and JDisplayArea and JScrollPane for the scroll pane.
    Here are two images in case you can't visualize what I am saying. This is what it looks like now:
    http://img127.imageshack.us/img127/1294/beforeob1.jpg
    And this is how it should be:
    http://img127.imageshack.us/img127/8724/aftedzu7.jpg
    Help would be greatly appreciated. Thanks in advance.

    Does the class that implement your game panel provide a meaningful return value for the method "getPreferredSize()"? I guess you use a BorderLayout, don't you? In this case the game panel isn't visible because it doesn't tell the LayoutManager what size it wants and so it gets a 0,0 size.
    Greetings
    Stefan

  • Need help with a xml photo gallery

    First, hello to everyone. My name is Tudor , i'm from Romania and i have a flash project which implies building an XML driven scrolling photo galery. Very sorry if my english will slip in some phrases. Well , the question for which i must get an answer is: I already built the gallery, everything works ok.... but ... when i want to make some changes when the pictures load .... well here is the problem. I will print the code and briefly explain and ask at the end....
    import com.greensock.TweenLite;
    import com.greensock.TweenMax;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.*;
    import fl.containers.UILoader;
    var MASK_WIDTH:Number = myMask_mc.width;
    var menuHolder:MovieClip = new MovieClip();
    //menuHolder.x = myMask_mc.x;
    //menuHolder.y = myMask_mc.y;
    addChild(menuHolder);
    var mouseIsOver:Boolean = false;
    var oldX:Number = menuHolder.x;
    menuHolder.mask = myMask_mc;
    import flash.filters.ColorMatrixFilter;
    import fl.motion.AdjustColor;
    var color : AdjustColor;
    var colorMatrix : ColorMatrixFilter;
    var matrix : Array;
    var filterBW : Array;
    color = new AdjustColor();
    color.brightness = 20;
    color.contrast = 20;
    color.hue = 0;
    color.saturation = -100;
    matrix = color.CalculateFinalFlatArray();
    colorMatrix = new ColorMatrixFilter(matrix);
    filterBW = [colorMatrix];
    /// HERE i read and parse the XML
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("C:/Documents and Settings/Sm/Desktop/feteModel.xml"));
    function LoadXML(e:Event):void
    xmlData = new XML(e.target.data);
    ParsePictures(xmlData);
    function ParsePictures(input:XML):void
    var mainPictures:Array = new Array();
    var firstPictures:Array = new Array();
    var secondPictures:Array = new Array();
    var thirdPictures:Array = new Array();
    var forthPictures:Array = new Array();
    var dimensiuniArray:Array = new Array();
    var heightArray:Array = new Array();
    var eyeColorArray:Array = new Array();
    var hairColorArray:Array = new Array();
    var numeArray:Array = new Array();
    var mainPicturesList:XMLList = input.fata.pozaPrincipala;
    var firstPicturesList:XMLList = input.fata.poza1;
    var secondPicturesList:XMLList = input.fata.poza2;
    var thirdPicturesList:XMLList = input.fata.poza3;
    var forthPicturesList:XMLList = input.fata.poza4;
    var dimensiuniList:XMLList = input.fata.dimensiuni;
    var heightList:XMLList = input.fata.inaltime;
    var eyeColorList:XMLList = input.fata.culoare_ochi;
    var hairColorList:XMLList = input.fata.culoare_par;
    var numeList:XMLList = input.fata.nume;
    for each (var element1:XML in mainPicturesList)
    mainPictures.push(element1);
    for each (var element2:XML in numeList)
    numeArray.push(element2);
       /////////// HERE I LOAD THE PICTURES ...... i must say that menuItem is a mc - exported as a class , which basically has inside a textfield, a UILoader and a preloader - also movieclip. Also i need the pictures to be black and white when they are displayed and when the mouse is over to color
    for (var i=0; i < mainPictures.length; i++)
    var menuItem:MenuItem;
    menuItem = new MenuItem();
    menuItem.y = 200;
    menuItem.x =(i * (menuItem.width+1))+150;
    menuItem.itemLoader.filters = filterBW;
    menuItem.itemText.text = numeArray[i];
    menuItem.itemLoader.source = mainPictures[i];
    menuItem.itemLoader.maintainAspectRatio = false;
    menuItem.itemLoader.addEventListener(Event.COMPLETE, completeHandler);
    //menuItem.itemLoader.addEventListener(Event.COMPLETE,uiLoaded, false, 0, true);
    //menuItem.itemLoader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    //menuItem.itemLoader.load();
    //menuItem.preloader_mc.visible = true;
    function completeHandler(event:Event)
         //trace(menuItem.itemText.text);
    menuItem.mouseChildren = false;
    menuItem.buttonMode = true;
      menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
      menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
      //Add the menuItem to the menuHolder
      menuHolder.addChild(menuItem);
    menuHolder.addEventListener(MouseEvent.MOUSE_OVER, mouseOverMenu);
    menuHolder.addEventListener(MouseEvent.MOUSE_OUT, mouseOutMenu);
    function mouseOverMenu(e:Event):void
    mouseIsOver = true;
    //Calculate the vertical distance of how far the mouse is from
    //the topleft  of the mask.
    var distance:Number = mouseX - myMask_mc.x;
    //Calculate the distance in percentages
    var percentage:Number = distance / MASK_WIDTH;
    //Save the holder's old y coordinate
    oldX = menuHolder.x;
    var targetX:Number = -((menuHolder.width - MASK_WIDTH +150) * percentage) + myMask_mc.x;
    //Tween the menuHolder to the target coordinate
    TweenMax.to(menuHolder, 5, {x: Math.round(targetX)});
    //This function is called when the mouse is out of the menu
    function mouseOutMenu(e:Event):void
    mouseIsOver = false;
    var tw1:Tween;
    var tw2:Tween;
    function mouseOverItem(e:Event):void
    var item:MenuItem = e.target as MenuItem;
    menuHolder.addChild(item);
    item.itemLoader.filters = [];
    //trace(item.itemText.text);
    tw1 = new Tween(item,"scaleX", Strong.easeInOut,1, 1.25,0.25,true);
    tw2 = new Tween(item,"scaleY", Strong.easeInOut,1, 1.25,0.25,true);
    //This function is called when mouse moves out of the item
    function mouseOutItem(e:Event):void
    var item:MenuItem = e.target as MenuItem;
    item.itemLoader.filters = filterBW;
    tw1 = new Tween(item,"scaleX", Strong.easeInOut,1.25, 1,0.25,true);
    tw2 = new Tween(item,"scaleY", Strong.easeInOut,1.25, 1,0.25,true);
    Now , i want each picture to scale when it fully loads ... i thought it will be enough to put it on the completeHandler function , but here is the problem - it scales only the last picture ..... eg. if there are 5 , it scales only the 5th ..... i tried to trace the name of the picture inside the completeHandler and also , i got 4 identical names - the name of the last picture ...... my question  is : why is the completeHandler firing only for the last item?   anyone has any idea why this is hapening? and more how can i fix it? PLEASE ... i'm burning my brain here for half a day here ..........  THANKS in advance!!!!!!!!!!!!!!!!!!   
                                                                                                                                                                    REGARDS, Tudor

    If you are using a "for" loop to do the loading, it can process thru the entire set of loops before the first image is loaded.  If you want to have control over the loading you should load things sequencially.
    So instead of using a for loop, build a pseudo loop using an array of the files to load, a counter variable, a loading function, and a loadComplete function.  Have the loading function load just one image using the counter variable to identify which image in the array to load.  Have the loadComplete function process the one image that was just kloaded, increment the counter, and call the loading function if the counter value does not equal the length of the array.

  • Need help with Threading GUI progress bar

    Anyone able to help? I'm sure you've seen this a million times. I've google'd around and tried examples but still can't get a progress bar to work properly under the following situation:
    1. Created a panel with several components to select directory, display directory in tree etc.
    2. When a specific button (Search) is clicked, I want a secondary window to popup and report progress of searching down the directory.
    As you'll probably guess, the progress window isn't being updated until the end. I'm using Threads and using InvokeLater but nothing happens. Is there any good example that does the above? I can't seem to find one to figure this out.
    Thanks
    Speedy.
    Sample code:
    main.java:
    ========
    public class Main {
    public static void main(String[] args) {
    MainPanel mainPanel = new MainPanel();
    mainPanel.show();
    MainPanel.java:
    ============
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class MainPanel extends JFrame implements ActionListener {
    public MainPanel() {
    this.setSize(100,100);
    JButton startButton = new JButton("Start");
    this.getContentPane().add(startButton);
    startButton.addActionListener(this);
    public void actionPerformed(ActionEvent event) {
    ProgressPanel pp = new ProgressPanel();
    pp.show();
    SimpleTask st = new SimpleTask(pp);
    st.start();
    while (st.isAlive()) {
    System.err.println("waiting..");
    try {
    Thread.sleep(100);
    } catch (Exception e) {};
    System.err.println("finished!");
    SimpleTask.java:
    =============
    import javax.swing.SwingUtilities;
    public class SimpleTask extends Thread {
    ProgressPanel pp = null;
    public SimpleTask(ProgressPanel _pp) {
    pp = _pp;
    this.setDaemon(true);
    int i = 0;
    String position = "";
    public void run() {
    Runnable updateGUI = new Runnable() {
    public void run() {
    pp.setText(position);
    try {
    for (i=0; i<50; i++) {
    position = "Now on = " + new Integer(i).toString();
    System.err.println(position);
    SwingUtilities.invokeLater(updateGUI);
    sleep(100);
    } catch (Exception e) {}
    ProgressPanel.java:
    ===============
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    public class ProgressPanel extends JFrame {
    private JLabel label = new JLabel();
    public ProgressPanel() {
    this.setSize(200,200);
    this.setLocation(100,100);
    this.getContentPane().add(label);
    setText("Start");
    public void setText(String text) {
    label.setText(text);
    }

    Ok, I'll look down that road. I should have said the Thread is being used because the current while loop will be changed to perform real work. Just an example at the moment to show what I'm trying to do. Does this make a difference? The real task will be to drill down directories, counting file types/dirs etc...

Maybe you are looking for

  • Animated .gif header help!

    I have been asked to create an animated header using a .gif because the client wants the animation viewable on iPhones.  How can I get a logo to "wipe" while using a transparent background?  I tried using a mask but you see the white box.  Is there a

  • After acceessing home screen with assistive touch auto lock is not working in my iphone 4S after upgrading to ios6

    After acceessing home screen with assistive touch auto lock is not working in my iphone 4S after upgrading to ios6

  • Increase in usage query

    I have been on option one for ever and have never gone over my usage allowance (10gb), now all of a sudden it has shot up. 27gb in august, 43 gb in sept and already on 9.1gb for october. Nothing has changed at my end- no one games on line, downloads

  • Limit rows in select statement

    Hi, we have the following SQL select statement in an extension in our CMS system var newConn = new openConnection(); if(request.searchBox)      var searchBox = request.searchBox;      var keywords = searchBox.split(' ')      var sql = 'SELECT forumID

  • How to solved RFC connection (EarlyWatch)

    Hi, I having problem in Solution Manager 4.0 (EarlyWatch Report) R/3 landscape (NDV,NQA,NPR) NDV and NPR does works fine and getting EWA everyweek which is schedule every week NQA does not work at all Screenshot here: http://www.flickr.com/photos/252