Hi guys need Help with Displaying Splash Screen?!!?

Hi Guys.
Sorry for the last incomplete post my mistake!
I need help displaying a splash screen as an advertisment or something before i have my main application run.
Here is the code i wrote (it works as if it were a seperate application)
package MajourProject;
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Robot;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JWindow;
* @author Matt
public class SplashScreen extends JWindow
    public SplashScreen()
        int UpTime = 20000;
        Start(UpTime);
    public void Start(int UpTime)
        ImageIcon ii = new ImageIcon("src/1.jpg");
          JScrollPane jsp = new JScrollPane(new JLabel(ii));
                JProgressBar Bar = new JProgressBar();
          getContentPane().add(jsp);
          setSize(853,303);
          centerScreen();
          setVisible(true);
               try
                            Thread.sleep(20000);
                           dispose();
               catch(Exception IE)
        private void centerScreen()
                Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
                int x = (int) ((d.getWidth() - getWidth()) / 2);
          int y = (int) ((d.getHeight() - getHeight()) / 2);
          setLocation(x, (y-100));
       public static void main(String [] args)
             new SplashScreen();
}but i now have a problem as i already have a main application done as i wrote this seperately. I now need to combine the two together. So what i did was in my Main Application wrote:
Splash_Screen SS = new Splash_Screen();it then runs my Splash Screen class which i re-wrote to look as such:
package MajourProject;
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Robot;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JWindow;
* @author Matt
public class SplashScreen extends JWindow
    public SplashScreen()
        int time = 15000;
        Start(time);
    public void Start(int UpTime)
        ImageIcon ii = new ImageIcon("src/1.jpg");
          JScrollPane jsp = new JScrollPane(new JLabel(ii));
                JProgressBar Bar = new JProgressBar();
          getContentPane().add(jsp);
          setSize(853,303);
          centerScreen();
          setVisible(true);
               try
                            Thread.sleep(20000);
                            dispose();
               catch(Exception IE)
        private void centerScreen()
                Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
                int x = (int) ((d.getWidth() - getWidth()) / 2);
          int y = (int) ((d.getHeight() - getHeight()) / 2);
          setLocation(x, (y-100));
}it obviously runs the default constructor which then runs the other methods in the class but it doesn't seem to show can anybody help me to find out whats wrong? It seems to be there just before the main application launches but only for a split second. And when i am waiting while the thread is sleeping the area i have defined the Content pane for he cursor goes to the loading icon! I don't know if this makes any sence to you but if you can help me it would be most apreciated.
Thanks.

SpearOne wrote:
Hi Encephalopathic
why would it work if i put it in it's own application surely it wouldn't be caused by this thread.sleep?? everything after it is in fact put to sleep. In its "own" application, nothing happens after it is displayed.
if it is the problem then could you please give me some code to add quickly to test??
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JWindow;
import javax.swing.Timer;
public class SplashScreen extends JWindow
  private static final String IMAGE_PATH = "src/1.jpg";
  private static final int UP_TIME = 15000;
  public SplashScreen()
    Start();
  public void Start()
    ImageIcon ii = new ImageIcon(IMAGE_PATH);
    JScrollPane jsp = new JScrollPane(new JLabel(ii));
    //JProgressBar Bar = new JProgressBar();
    getContentPane().add(jsp);
    setSize(853, 303);
    centerScreen();
  private void centerScreen()
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (int) ((d.getWidth() - getWidth()) / 2);
    int y = (int) ((d.getHeight() - getHeight()) / 2);
    setLocation(x, (y - 100));
  public static void main(String[] args)
    final JFrame frame = new JFrame("Main Frame");
    frame.setPreferredSize(new Dimension(300, 200));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    final SplashScreen splash = new SplashScreen();
    splash.setVisible(true);
    Timer swingTimer = new Timer(UP_TIME, new ActionListener()
      public void actionPerformed(ActionEvent e)
        splash.dispose();
        frame.setVisible(true);
    swingTimer.setRepeats(false);
    swingTimer.start();
}

Similar Messages

  • Need Help with inserting a screen shot

    Can someone pleassse help me?! If any of you are familiar with popular youtubers and how in their videos they include screen shots of facebook or twitter questions and they have them so they roll across the bottom  of the screen, can you please help me! If anyone knows how to do this in Imovie 11 it would be HUGELY appreciated! Because when i try the picture in picture settings it zooms the screen shot so its massive and its also not an oblong shape anymore (like the shape of a facebook reply) i also need help at how this would transition to roll in from one side of the screen to the other?!
    PLEASE HELP ME!!

    I think it is possible to do this in iMovie, although perhaps easier in Final Cut Pro X, which I would guess that iJustine is using.
    First, I would take a still image of my video at the points where I want to superimpose a graphic. Since she is mostly superimposing graphics on her talking head, a single still might be sufficient.
    For getting a still out of iMovie, see my User Tip here.
    https://discussions.apple.com/docs/DOC-3231
    Now, you will want to take this still to a photo editor that allows you to edit layers. Use PhotoShop if you have it. If you do not already have PhotoShop, it can be rather expensive, so I would suggest a tool like Acorn or Pixelmator, which I think are available in the Mac App Store.
    Create a project in the dimensions of your iMovie still, e.g. 1920x1080.
    You would put the still on the bottom layer, so you know where to put yoru graphics. You would position the graphic or screen grab at the next layer up. Now I would export the upper layer only as a PNG file. The PNG file has an Alpha Channel, which means you will see only the graphic and not the still in the background.
    The main thing Final Cut Pro would give you would be the easy ability to have multiple graphics on the screen at the same time.
    Now you can drag this PNG file into iMovie and drop it on the project clip where you want it to appear. A popup menu will appear. Choose Cutaway.
    There are probably other ways to do this, but that is the way I would do it.

  • Need help with ipohne, white screen!!

      i got given a iphone and had to get the screen fixed on it so i bought a kit , but the only thing is when its turned on it only lights up with a white screen. you can touch the screen and it makes noises and so fourth but you cant see anything but a white screen, i have no clue what to do ... HELP PLEASE!!!

    Since the screen turns off see if:
    - Placing the iPod in Recovery mode will allow a restore via iTuns.
    - Next try DFU mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    If you still have the problem the it appears that either the drop caused other damage or upi damaged the iPod or did something incorrect whenyou replaced the screen
    BTW, the white screen of death is when the screen turns white AND you can turn it off.

  • Hello guys need help with reverse array

    Need help reversing an array, i think my code is correct but it still does not work, so im thinking it might be something else i do not see.
    so far the input for the array is
    6, 25 , 10 , 5
    and output is still the same
    6 , 25 , 10 , 5
    not sure what is going on.
    public class Purse
        // max possible # of coins in a purse
        private static final int MAX = 10;
        private int contents[];
        private int count;      // count # of coins stored in contents[]
         * Constructor for objects of class Purse
        public Purse()
           contents = new int[MAX];
           count = 0;
         * Adds a coin to the end of a purse
         * @param  coinType     type of coin to add
        public void addCoin(int coinType)
            contents[count] = coinType;
            count = count + 1;
         * Generates a String that holds the contents of a purse
         * @return     the contents of the purse, nicely formatted
        public String toString()
            if (count == 0)
                return "()";
            StringBuffer s = new StringBuffer("(");
            int i = 0;
            for (i = 0; i < count - 1; ++i)
                s.append(contents[i] + ", "); // values neatly separated by commas
            s.append(contents[i] + ")");
            return s.toString();
         * Calculates the value of a purse
         * @return     value of the purse in cents
        public int value()
            int sum = 0; // starts sum at zero
            for( int e : contents) // sets all to e
                sum = sum + e; //finds sum of array
            return sum; //retur
         * Reverses the order of coins in a purse and returns it
        public void reverse()
           int countA = 0;
           int x = 0;
           int y = countA - 1;                                          // 5 - 1 = 4
           for (int i = contents.length - 1; i >=0 ; i--)                        // 4, 3 , 2, 1, 0
                countA++;                                             // count = 5
            while ( x < y)
                int temp = contents[x];
                contents[x] = contents [y];
                contents [y] = temp;
                y = y- 1;                                         // 4 , 3 , 2, 1 , 0
                x = x + 1 ;                                             // 0 , 1,  2  , 3 , 4
    }

    ok so i went ahead and followed what you said
    public void reverse()
          int a = 0;
          int b = contents.length - 1;
          while (b > a)
              int temp = contents[a];
              contents[a] = contents;
    contents [b] = temp;
    a++;
    b--;
    }and its outputting { 0, 0, 0, 0}
    im thinking this is because the main array is has 10 elements with only 4 in use so this is a partial array.
    Example
    the array is { 6, 25, 10, 5, 0, 0, 0, 0, 0, 0,}
    after the swap
    {0, 0 , 0 , 0, 0 , 0 , 5 , 10 , 25, 6}
    i need it to be just
    { 5, 10, 25, 6}
    so it is swapping the begining and end but only with zeroes the thing is i need to reverse the array without the zeroes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help with Responsive HTML5 screen layout in RoboHelp HTML 11

    I have a few questions/issues regarding screen layouts for Responsive HTML5 output in RoboHelp HTML 11.
    First off, I decided to just use the Theme1_Standard layout that came with the program (only other default option was Theme2_Government) and started customizing the layout. I originally added a company logo to the 'Header' component in the Customization dialog, but have since decided to remove it. I can't seem to do this from the dialog, so I tried just deleting the image file from the whole project. The file is gone, but the logo is still there. This is only displayed in the header when a topic is displayed, it does not appear in the header at the TOC, Index, Search screen, etc. How do I get rid of this???
    Secondly, the text in the header for the topic screens appears differently than the one on the screens for the TOC, Index, Search, etc. In the former of these, the header is displayed in maroon text in a much smaller font, similar to that used in the topics. In the latter, the topic is displayed based on what I configured in the Layout Customization dialog; much larger in white text on a black background. In each case the heading text serves as a link to the default display topic shown when the help file is launched, which is fine. However, how do I get the header to be consistent across all screens (topics and TOC, Index, etc. alike)???
    As a result of these issues with the Theme1_Standard layout, I'm trying to import a different Responsive HTML5 screen layout than the two provided within RoboHelp HTML 11 (Standard and Government). I did some digging in the program help and found another layout I'd like to use (Theme3_Black.zip) at RoboHelp screen profiles and layouts. I tried importing the new layout, but it's looking for a .SLZ file and the only one in the files that came with the ZIP file is SLZConfig.xml, and I don't think that's what I need, though quite honestly, I don't know.
    I extracted the contents of the ZIP folder to a folder in the !ScreenLayout! folder within the RoboHelp project, but when I open the project, I don't see Theme3_Black as an option. I need to figure out how to import this screen layout because the color scheme matches the one used in the program for which I am writing the help. How do I import and apply this other screen layout???
    Any tips, tricks, or guidance on any or all of these items would be GREATLY appreciated.
    Thanks much in advance,
    Dave

    Item two of the original post is also something I am having issues with:
    "Secondly, the text in the header for the topic screens appears differently than the one on the screens for the TOC, Index, Search, etc. In the former of these, the header is displayed in maroon text in a much smaller font, similar to that used in the topics. In the latter, the topic is displayed based on what I configured in the Layout Customization dialog; much larger in white text on a black background. In each case the heading text serves as a link to the default display topic shown when the help file is launched, which is fine. However, how do I get the header to be consistent across all screens (topics and TOC, Index, etc. alike)???"
    We have the text toggle between red, white and blue depending upon the topic selected. In the customize Selected Layout we have the title color set to white. It seems to think that it is a link and I would like to know how I can force the text to be white and to stay that way no matter which topic is selected.

  • Really need help with a loading screen

    Ok, here's my problem, I'm making a puzzle game and I can't seem to make my loading screen work with my main menu. The loading screen is represented by an image filling up with colour where the colouring takes place by means of a thread (and there's a string as well that paints the %) . Now the loading screen is supposed to appear after i click the start button from the main menu and after completely filling up (or when the tread dies) the game panel is suppposed to be show on screen. Between the loading I initialize all the components for the game. Now, when I press the start button, the whole screen freezes (for the duration of the loading thread) after which the game screen appears. What puzzles me more is that if i don't add the game screen the loading screen works like a charm.
    Here's some of the code:
    public void actionPerformed(ActionEvent e){
    if(e.getActionCommand().compareTo("Start")==0){
    //initializing the panel for the loading
    ds=new Load();
    //initializing the thread that makes the panel rainbow dream
    anm=new Ompy();
    x.remove(pent); //pent is the jpanel containing the main menu with the customised buttons, and x is the reference to the current JFrame's content pane
    x.add(ds);
    pack();
    /* MediaTracker tracker=new MediaTracker(this);
    tracker.addImage(ds.pic.im,2); //i tried using a media tracker to wait for the image of the loading jpanel
    tracker.addImage(ds.fill.im,2);
    try{tracker.waitForID(2);}
    catch(InterruptedException ie){} */
    anm.start(); //i start the thread
    //without the folowing code the loading screen works perfectly
    some code
    Winx gs=new Winx(); //the panel containing the game interface
    some code
    while(anm.isAlive()){}
    x.remove(ds); // i remove the loading screen
    x.add(gs); //i add the game screen
    anm=null;
    ds=null;
    setVisible(true);
    gigaslave.requestFocusInWindow();
    pack();
    //here ends the code that shadows my loading screen :((
    else {System.exit(0);}}
    }I appreciate your help.

    Thanks for all your help ...this is what i have so far and am working with:
    import javax.swing.JOptionPane;
    public class TVRemote{
         int volume = 5;
         int channel = 5;
         public void channelUp(){
              if(channel < 25){
                   channel++;
         public void channelDown(){
              if(channel > 1){
                   channel--;
         public void volumeUp(){
              if(volume < 10){
                   volume++;
         public void volumeDown(){
              if(volume > 1){
                   volume--;
    public class VCRemote extends TVRemote{
         String tape = null;
         String mode = "Stop";
         public void insertTape(String t){
              tape = t;
         public void ejectTape(){
              tape = null;
         public void setMode(String m){
              mode = m;
         public String getMode(){
              return mode;
    public String getMode(){
              if(tape == null){
                   System.out.println("There is no tape");
              return mode;
    I know it does have to be set as 2 files....I still need to put in a rewind and fast forward option would that be done the same way that public void insetTape is done? also I was wondering how i will interface it with the user? Cause the only output i see is a display message that there isn't any tape in the vcr.
    Thankgs again for everyones help.

  • AT300 - need help with display brightness

    Hello! Help solve the problem with the AT300 tablet.
    Balanced consumption charge off, automatic brightness control is also disabled. But when watching videos, surfing and gaming brightness still varies depending on the color of the image. If the image is dark, the brightness decreases, if the picture is brighter - the screen gets brighter. How do to fix the brightness?
    Thanks!

    Hello,
    I have the same problem like flash85.
    When I scroll down on bright websites and a darker picture is shown on the screen,
    the whole display becomes much darker and even the colors on the screen change.
    Yesterday I've tried the same website on an IPad and the background and colors perfectly
    stays the same.
    Also the display permanently dimms down or up if the automatic brightness control is
    enabled. This is also very disturbing.
    I can't imagine that this behaviour is normal. I read many tests before and none of it mentioned this.

  • Need help with clearing on screen data

    Hi all,
    I have a transaction which works like SM30 (table maintenance). In my main screen, I have 50 blank fields (created by appending 50 blank rows to an internal table) on the ALV grid for user new entries with 2 buttons: Save and Delete. Once the user has entered the data and click on Save, it will validate the entries and put into internal table before saving into the database.
    The problem arise when I want to delete the entries. When user click on Delete, it will clear the entries in the selected row. My problem is, how do I clear the data on the screen since this data is not yet inserted into internal table? These entries are new entries just entered by the users and not being put into internal table or in the database yet.

    Once user press the delete button ,
    in the user_command event you need to
    first insert the values to internal table with delete flag in the internal table , then delete the line the user selected for delete,
    then call
    method "g_grid->refresh_table_display" after row has been deleted.
    aRs

  • Camera guy needs help with his first build

    Hello all-
    I work in a video rental house, and I'm sick of renting out $13,000 cameras and $16,000 lens packages all the time and not having the capability to get the gear for free and make my own projects on my own time!  To that end, I'll happily trade any video camera / production knowledge for advice on this build I'm working on.
    I’ve put together this modest $3,000 build list for a Premiere CS5 / After Effects CS5 machine.  This will be my first build, so I’m somewhat new to this, and I’d like to solicit the board’s input on the following questions:
    1)      What do you think of my MOBO / CPU / RAM pairings?  I’m not really married to any of these components, and if I should swap any one of these out for overall performance increases, I’d be happy to.
    2)      How does my drive setup look?  Have I picked any clunkers?
    3)      I’d love to hear any alternate suggestions for 20inch or so monitors in the $150 range, or quality desktop speakers in the $100 range.
    DISK SETUP- $640
                System / Boot disk – 600 GB Western Digital Velociraptor / SATA 6.0 / 10,000 RPM
                Project / Media disk – (2) x 1TB Samsung Spinpoint F3R / RAID 0 / SATA 3.0 / 7,200 RPM
                Render / Scratch disk – (4) x 500GB Western Digital Caviar blue / RAID 0 / SATA 3.0 / 7,200 RPM
    (MOBO raid only- No hardware RAID card – not in my budget right now)
    GUTS- $1,137
                CPU- i7-950 Bloomfield 3.06 GHz / Noctura NH-D14 CPU cooler
                GPU- Galaxy NVDIA GTX470 1.28 GB
                RAM- 24GB (6 x 4GB) G.SKILL Ripjaw DDR3 1333 / 9-9-9-24
                MOBO – ASUS Rampage III 1366 pin X58
    CASE / POWER - $595         
                Case - Silverstone RV02B-W
                PSU – ABS MJ1100-M / 1100 Watt / Single 12v rail
                UPS – Powercom KIN- 2200AP / 2200 VA / 1320 Watts
    HUMAN I/O – $485
                Speakers- Behringer MS16
                Mouse – Kensington Expert Trackball
                Keyboard – Logitech Wireless K340
                Monitors – (2) x Acer G235HAbd 23” / 1920x1080 / 20” or larger / around $150
    Thanks for any input.
    -Leo

    Leo,
    Nice system specification! Like Harm, I don't have much to suggest - only a comment on the keyboard!
    I personally went with the Logitech K800, which is also wireless, after comparing it with the K340 in a store that had both on display. I preferred the feel of this more expensive model and am still very happy with the purchase 6 months later. The K800 also adds backlighting which I love for editing in a dimly lit room.
    Jim

  • Need help with log in screen

    My log in screen(after clicking the skype icon) will only let me type in my username and password but won't let me click any buttons or boxes. I have the free version and it worked on my previous computer. I already tried reinstalling it and keep getting the same thing. Please help!!

    jasmine_taulbor wrote:
    My log in screen(after clicking the skype icon) will only let me type in my username and password but won't let me click any buttons or boxes. I have the free version and it worked on my previous computer. I already tried reinstalling it and keep getting the same thing. Please help!!
    Do you have all Windows updates and updates to any hardware devices by the manufacturers?
    What version of IE ("Internet Explorer") do you have? You can tell by opening a Internet Explorer Browser window and then doing:
    Help -> About Internet Explorer
    About Me You can also use a IP Camera as your camera for Skype video Example Instructions

  • Need help with Share My Screen tool in InDesign CS5.5

    I am trying to use the screen sharing tool and keep getting an error message, "Updating your account. We are currently updating your account. Please wait a few minutes and try again." How do I get past this?

    Thank you Bob. I had heard they killed it in CS6 but thought it might still work in CS5. We did try using Google Plus and were able to see other docs but not our InDesign doc (it appeared black). We thought maybe Adobe wanted us to buy their product.... Maybe we should try it again, or another one. Are you familiar with any of these?
    http://www.makeuseof.com/tag/12-excellent-free-screen-sharing-and-remote-access-tools-you- havent-heard-of-yet/
    He gives 4 out of 5 stars to
    Crossloop
    Yugma SE For Skype
    Mikogo 4.5 stars

  • Need help with displaying content on multiple pages

    Hi I'm kind of a dreamweaver newbie and i'm a little in over
    my head. I'm trying to design a web site with the same content
    appearing on multiple pages. Here's the current site...
    http://home.comcast.net/~gascec/cecnh20/index.html
    I'm trying to establish the top bar and side bars of links
    and the logo on each page from one point so i don't have to change
    forty pages if i update a link.
    I know there's a way to do this and i thought it was using a
    CSS page but i can't figure it out and i'm running out of time.
    Help

    Got it. Thank you. I'm having one other problem though. I
    keep getting this bizare message every time i save or try to use
    the template:
    The is an error at line 41 column 7 (absolute position 2486)
    of "~pathandfilename.dwt": Nested editable regions
    The only thing at line 41 is the <body> tag. I took all
    the formating out to try to trim this out... any thoughts about
    this one.
    Thanks G

  • I need help with display settings on

    When Im watching movies is their any way to change the contrast or anything because it only lets me change brightness

    Only brightness can be changed. You could email the developers relations and ask them to make a contrast settings

  • Need help on displaying the callers name on ip phone with cme using external directory

    Hello Guys,
    Need help on displaying the callers name on ip phone with cme while using external directory
    Thank you,
    Khaja

    Thanks for your help,
    Does it 100% work with CME. We use SIP and 2ring for external directory?  Thanks you.

  • Need help with JTextArea and Scrolling

    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    public class MORT_RETRY extends JFrame implements ActionListener
    private JPanel keypad;
    private JPanel buttons;
    private JTextField lcdLoanAmt;
    private JTextField lcdInterestRate;
    private JTextField lcdTerm;
    private JTextField lcdMonthlyPmt;
    private JTextArea displayArea;
    private JButton CalculateBtn;
    private JButton ClrBtn;
    private JButton CloseBtn;
    private JButton Amortize;
    private JScrollPane scroll;
    private DecimalFormat calcPattern = new DecimalFormat("$###,###.00");
    private String[] rateTerm = {"", "7years @ 5.35%", "15years @ 5.5%", "30years @ 5.75%"};
    private JComboBox rateTermList;
    double interest[] = {5.35, 5.5, 5.75};
    int term[] = {7, 15, 30};
    double balance, interestAmt, monthlyInterest, monthlyPayment, monPmtInt, monPmtPrin;
    int termInMonths, month, termLoop, monthLoop;
    public MORT_RETRY()
    Container pane = getContentPane();
    lcdLoanAmt = new JTextField();
    lcdMonthlyPmt = new JTextField();
    displayArea = new JTextArea();//DEFINE COMBOBOX AND SCROLL
    rateTermList = new JComboBox(rateTerm);
    scroll = new JScrollPane(displayArea);
    scroll.setSize(600,170);
    scroll.setLocation(150,270);//DEFINE BUTTONS
    CalculateBtn = new JButton("Calculate");
    ClrBtn = new JButton("Clear Fields");
    CloseBtn = new JButton("Close");
    Amortize = new JButton("Amortize");//DEFINE PANEL(S)
    keypad = new JPanel();
    buttons = new JPanel();//DEFINE KEYPAD PANEL LAYOUT
    keypad.setLayout(new GridLayout( 4, 2, 5, 5));//SET CONTROLS ON KEYPAD PANEL
    keypad.add(new JLabel("Loan Amount$ : "));
    keypad.add(lcdLoanAmt);
    keypad.add(new JLabel("Term of loan and Interest Rate: "));
    keypad.add(rateTermList);
    keypad.add(new JLabel("Monthly Payment : "));
    keypad.add(lcdMonthlyPmt);
    lcdMonthlyPmt.setEditable(false);
    keypad.add(new JLabel("Amortize Table:"));
    keypad.add(displayArea);
    displayArea.setEditable(false);//DEFINE BUTTONS PANEL LAYOUT
    buttons.setLayout(new GridLayout( 1, 3, 5, 5));//SET CONTROLS ON BUTTONS PANEL
    buttons.add(CalculateBtn);
    buttons.add(Amortize);
    buttons.add(ClrBtn);
    buttons.add(CloseBtn);//ADD ACTION LISTENER
    CalculateBtn.addActionListener(this);
    ClrBtn.addActionListener(this);
    CloseBtn.addActionListener(this);
    Amortize.addActionListener(this);
    rateTermList.addActionListener(this);//ADD PANELS
    pane.add(keypad, BorderLayout.NORTH);
    pane.add(buttons, BorderLayout.SOUTH);
    pane.add(scroll, BorderLayout.CENTER);
    addWindowListener( new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    String arg = lcdLoanAmt.getText();
    int combined = Integer.parseInt(arg);
    if (e.getSource() == CalculateBtn)
    try
    JOptionPane.showMessageDialog(null, "Got try here", "Error", JOptionPane.ERROR_MESSAGE);
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Got here", "Error", JOptionPane.ERROR_MESSAGE);
    if ((e.getSource() == CalculateBtn) && (arg != null))
    try{
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 1))
    monthlyInterest = interest[0] / (12 * 100);
    termInMonths = term[0] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 2))
    monthlyInterest = interest[1] / (12 * 100);
    termInMonths = term[1] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 3))
    monthlyInterest = interest[2] / (12 * 100);
    termInMonths = term[2] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Invalid Entry!\nPlease Try Again", "Error", JOptionPane.ERROR_MESSAGE);
    }                    //IF STATEMENTS FOR AMORTIZATION
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 1))
    loopy(7, 5.35);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 2))
    loopy(15, 5.5);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 3))
    loopy(30, 5.75);
    if (e.getSource() == ClrBtn)
    rateTermList.setSelectedIndex(0);
    lcdLoanAmt.setText(null);
    lcdMonthlyPmt.setText(null);
    displayArea.setText(null);
    if (e.getSource() == CloseBtn)
    System.exit(0);
    private void loopy(int lTerm,double lInterest)
    double total, monthly, monthlyrate, monthint, monthprin, balance, lastint, paid;
    int amount, months, termloop, monthloop;
    String lcd2 = lcdLoanAmt.getText();
    amount = Integer.parseInt(lcd2);
    termloop = 1;
    paid = 0.00;
    monthlyrate = lInterest / (12 * 100);
    months = lTerm * 12;
    monthly = amount *(monthlyrate/(1-Math.pow(1+monthlyrate,-months)));
    total = months * monthly;
    balance = amount;
    while (termloop <= lTerm)
    displayArea.setCaretPosition(0);
    displayArea.append("\n");
    displayArea.append("Year " + termloop + " of " + lTerm + ": payments\n");
    displayArea.append("\n");
    displayArea.append("Month\tMonthly\tPrinciple\tInterest\tBalance\n");
    monthloop = 1;
    while (monthloop <= 12)
    monthint = balance * monthlyrate;
    monthprin = monthly - monthint;
    balance -= monthprin;
    paid += monthly;
    displayArea.setCaretPosition(0);
    displayArea.append(monthloop + "\t" + calcPattern.format(monthly) + "\t" + calcPattern.format(monthprin) + "\t");
    displayArea.append(calcPattern.format(monthint) + "\t" + calcPattern.format(balance) + "\n");
    monthloop ++;
    termloop ++;
    public static void main(String args[])
    MORT_RETRY f = new MORT_RETRY();
    f.setTitle("MORTGAGE PAYMENT CALCULATOR");
    f.setBounds(600, 600, 500, 500);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    }need help with displaying the textarea correctly and the scroll bar please.
    Message was edited by:
    new2this2020

    What's the problem you're having ???
    PS.

Maybe you are looking for