How can I change  oval shape applet to (plot)

Hi this is not my code so, the orignal code is freeware to www.neuralsemantics.com and is Copyright 1989 by Rich Gopstein and Harris Corporation.
The site allows permission to play with the code or ammend it.
how could I modify the applet to display (plot) several cycles of the audio signal instead of the elliptical shape. The amplitude and period of the waveform should change in accordance with the moving sliders
Here is the code from www.neuralsemantics.com /applets/jazz.html
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class JazzMachine extends Applet
             implements Runnable, AdjustmentListener, MouseListener {
  // program name
  final static String TITLE = "The jazz machine";
  // Line separator char
  final static String LSEP = System.getProperty("line.separator");
  // Value range
  final static int MIN_FREQ = 1;   // min value for barFreq
  final static int MAX_FREQ = 200; // max value for barFreq
  final static int MIN_AMPL = 0;   // min value for barVolume
  final static int MAX_AMPL = 100; // max value for barVolume
  // Sun's mu-law audio rate = 8KHz
  private double rate = 8000d;      
  private boolean audioOn = false;     // state of audio switch (on/off)
  private boolean changed = true;      // change flag
  private int freqValue = 1;           // def value of frequency scrollbar
  private int amplValue = 70;          // def value of volume scrollbar
  private int amplMultiplier = 100;    // volume multiplier coeff
  private int frequency, amplitude;    // the requested values
  private int soundFrequency;          // the actual output frequency
  // the mu-law encoded sound samples
  private byte[] mu;
  // the audio stream
  private java.io.InputStream soundStream;
  // graphic components
  private Scrollbar barVolume, barFreq;
  private Label labelValueFreq;
  private Canvas canvas;   
  // flag for frequency value display
  private boolean showFreq = true;
  // width and height of canvas area
  private int cw, ch;
  // offscreen Image and Graphics objects
  private Image img;
  private Graphics graph;
  // dimensions of the graphic ball
  private int ovalX, ovalY, ovalW, ovalH;
  // color of the graphic ball
  private Color ovalColor;
  // default font size
  private int fontSize = 12;
  // hyperlink objects
  private Panel linkPanel;
  private Label labelNS;
  private Color inactiveLinkColor = Color.yellow;
  private Color activeLinkColor = Color.white;
  private Font inactiveLinkFont = new Font("Dialog", Font.PLAIN, fontSize);
  private Font activeLinkFont = new Font("Dialog", Font.ITALIC, fontSize);
  // standard font for the labels
  private Font ctrlFont;
  // standard foreground color for the labels
  private Color fgColor = Color.white;
  // standard background color for the control area
  private Color ctrlColor = Color.darkGray;
  // standard background color for the graphic ball area
  private Color bgColor = Color.black;
  // start value for the time counter
  private long startTime;
  // maximum life time for an unchanged sound (10 seconds)
  private long fixedTime = 10000;
  // animation thread
  Thread runner;
//                             Constructors
  public JazzMachine() {
//                                Methods
  public void init() {
    // read applet <PARAM> tags
    setAppletParams();
    // font for the labels
    ctrlFont = new Font("Dialog", Font.PLAIN, fontSize);
    // convert scrollbar values to real values (see below for details)
    amplitude = (MAX_AMPL - amplValue) * amplMultiplier;
    frequency = (int)Math.pow(1.2d, (double)(freqValue + 250) / 10.0);
    setLayout(new BorderLayout());
    setBackground(ctrlColor);
    setForeground(fgColor);
    Label labelVolume = new Label(" Volume ");
    labelVolume.setForeground(fgColor);
    labelVolume.setAlignment(Label.CENTER);
    labelVolume.setFont(ctrlFont);
    barVolume = new Scrollbar(Scrollbar.VERTICAL, amplValue, 1,
                     MIN_AMPL, MAX_AMPL + 1);
    barVolume.addAdjustmentListener(this);
    // assign fixed size to the scrollbar
    Panel pVolume = new Panel();
    pVolume.setLayout(null);
    pVolume.add(barVolume);
    barVolume.setSize(16, 90);
    pVolume.setSize(16, 90);
    Label labelFreq = new Label("Frequency");
    labelFreq.setForeground(fgColor);
    labelFreq.setAlignment(Label.RIGHT);
    labelFreq.setFont(ctrlFont);
    barFreq = new Scrollbar(Scrollbar.HORIZONTAL, freqValue, 1,
                  MIN_FREQ, MAX_FREQ);
    barFreq.addAdjustmentListener(this);
    // assign fixed size to the scrollbar
    Panel pFreq = new Panel();
    pFreq.setLayout(null);
    pFreq.add(barFreq);
    barFreq.setSize(140, 18);
    pFreq.setSize(140, 18);
    // show initial frequency value
    labelValueFreq = new Label();
    if (showFreq) {
      labelValueFreq.setText("0000000 Hz");
      labelValueFreq.setForeground(fgColor);
      labelValueFreq.setAlignment(Label.LEFT);
      labelValueFreq.setFont(ctrlFont);
    Panel east = new Panel();
    east.setLayout(new BorderLayout(10, 10));
    east.add("North", labelVolume);
    Panel pEast = new Panel();
    pEast.add(pVolume);
    east.add("Center", pEast);
    Panel south = new Panel();
    Panel pSouth = new Panel();
    pSouth.setLayout(new FlowLayout(FlowLayout.CENTER));
    pSouth.add(labelFreq);
    pSouth.add(pFreq);
    pSouth.add(labelValueFreq);
    south.add("South", pSouth);
    linkPanel = new Panel();
    this.composeLink();
    Panel west = new Panel();
    // dummy label to enlarge the panel
    west.add(new Label("      "));
    add("North", linkPanel);
    add("South", south);
    add("East", east);
    add("West", west);
    add("Center", canvas = new Canvas());
  private void composeLink() {
    linkPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
    linkPanel.setFont(inactiveLinkFont);
    linkPanel.setForeground(Color.yellow);
    Label labelName = new Label(TITLE + " \u00a9");
      labelName.setForeground(inactiveLinkColor);
      labelName.setAlignment(Label.RIGHT);
    labelNS = new Label(" Neural Semantics   ");
      labelNS.setForeground(inactiveLinkColor);
      labelNS.setFont(inactiveLinkFont);
      labelNS.setAlignment(Label.LEFT);
    linkPanel.add(labelName);
    linkPanel.add(labelNS);
    // link to Neural Semantics website
    String h = getDocumentBase().getHost();
    if ((h.length() > 4) && (h.substring(0, 4).equals("www.")))
      h = h.substring(4);
    if ((h != null) && (! h.startsWith("neuralsemantics.com"))) {
      // create a hand cursor for the hyperlink area
      Cursor linkCursor = new Cursor(Cursor.HAND_CURSOR);
      linkPanel.setCursor(linkCursor);
      labelName.addMouseListener(this);
      labelNS.addMouseListener(this);
  private void switchAudio(boolean b) {
    // switch audio to ON if b=true and audio is OFF
    if ((b) && (! audioOn)) {
      try {
        sun.audio.AudioPlayer.player.start(soundStream);
      catch(Exception e) { }
      audioOn = true;
    // switch audio to OFF if b=false and audio is ON
    if ((! b) && (audioOn)) {
      try {
        sun.audio.AudioPlayer.player.stop(soundStream);
      catch(Exception e) { }
      audioOn = false;
  private void getChanges() {
    // create new sound wave
    mu = getWave(frequency, amplitude);
    // show new frequency value
    if (showFreq)
      labelValueFreq.setText((new Integer(soundFrequency)).toString() + " Hz");
    // shut up !
    switchAudio(false);
    // switch audio stream to new sound sample
    try {
      soundStream = new sun.audio.ContinuousAudioDataStream(new
                        sun.audio.AudioData(mu));
    catch(Exception e) { }
    // listen
    switchAudio(true);
    // Adapt animation settings
    double prop = (double)freqValue / (double)MAX_FREQ;
    ovalW = (int)(prop * cw);
    ovalH = (int)(prop * ch);
    ovalX = (int)((cw - ovalW) / 2);
    ovalY = (int)((ch - ovalH) / 2);
    int r = (int)(255 * prop);
    int b = (int)(255 * (1.0 - prop));
    int g = (int)(511 * (.5d - Math.abs(.5d - prop)));
    ovalColor = new Color(r, g, b);
    // start the timer
    startTime = System.currentTimeMillis();
    // things are fixed
    changed = false;
//                               Thread
  public void start() {
    // create thread
    if (runner == null) {
      runner = new Thread(this);
      runner.start();
  public void run() {
    // infinite loop
    while (true) {
      // Volume or Frequency has changed ?
      if (changed)
        this.getChanges();
      // a touch of hallucination
      repaint();
      // let the children sleep. Shut up if inactive during more
      // than the fixed time.
      if (System.currentTimeMillis() - startTime > fixedTime)
        switchAudio(false);
      // let the computer breath
      try { Thread.sleep(100); }
      catch (InterruptedException e) { }
  public void stop() {
    this.cleanup();
  public void destroy() {
    this.cleanup();
  private synchronized void cleanup() {
    // shut up !
    switchAudio(false);
    // kill the runner thread
    if (runner != null) {
      try {
        runner.stop();
        runner.join();
        runner = null;
      catch(Exception e) { }
//                     AdjustmentListener Interface
  public void adjustmentValueChanged(AdjustmentEvent e) {
    Object source = e.getSource();
    // Volume range : 0 - 10000
    // ! Scrollbar value range is inverted.
    // ! 100 = multiplier coefficient.
    if (source == barVolume) {
      amplitude = (MAX_AMPL - barVolume.getValue()) * amplMultiplier;
      changed = true;
    // Frequency range : 97 - 3591 Hz
    // ! Scrollbar value range represents a logarithmic function.
    //   The purpose is to assign more room for low frequency values.
    else if (source == barFreq) {
      freqValue = barFreq.getValue();
      frequency = (int)Math.pow(1.2d, (double)(freqValue + 250) / 10.0);
      changed = true;
//                     MouseListener Interface
  public void mouseClicked(MouseEvent e) {
  public void mouseEntered(MouseEvent e) {
    // text color rollover
    labelNS.setForeground(activeLinkColor);
    labelNS.setFont(activeLinkFont);
    showStatus("Visit Neural Semantics");
  public void mouseExited(MouseEvent e) {
    // text color rollover
    labelNS.setForeground(inactiveLinkColor);
    labelNS.setFont(inactiveLinkFont);
    showStatus("");
  public void mousePressed(MouseEvent e) {
    try {
      java.net.URL url = new java.net.URL("http://www.neuralsemantics.com/");
      AppletContext ac = getAppletContext();
      if (ac != null)
        ac.showDocument(url);
    catch(Exception ex){ }
  public void mouseReleased(MouseEvent e) {
//                              Painting
  public void update(Graphics g) {
    Graphics canvasGraph = canvas.getGraphics();
    if (img == null) {
      // get canvas dimensions
      cw = canvas.getSize().width;
      ch = canvas.getSize().height;
      // initialize offscreen image
      img = createImage(cw, ch);
      graph = img.getGraphics();
    // offscreen painting
    graph.setColor(bgColor);
    graph.fillRect(0, 0, cw, ch);
    graph.setColor(ovalColor);
    graph.fillOval(ovalX, ovalY, ovalW, ovalH);
    // canvas painting
    if (canvasGraph != null) {
      canvasGraph.drawImage(img, 0, 0, canvas);
      canvasGraph.dispose();
//                          Sound processing
  // Creates a sound wave from scratch, using predefined frequency
  // and amplitude.
  private byte[] getWave(int freq, int ampl) {
    int lin;
    // calculate the number of samples in one sinewave period
    // !! change this to multiple periods if you need more precision !!
    int nSample = (int)(rate / freq);
    // calculate output wave frequency
    soundFrequency = (int)(rate / nSample);
    // create array of samples
    byte[] wave = new byte[nSample];
    // pre-calculate time interval & constant stuff
    double timebase = 2.0 * Math.PI * freq / rate;
    // Calculate samples for a single period of the sinewave.
    // Using a single period is no big precision, but enough
    // for this applet anyway !
    for (int i=0; i<nSample; i++) {
      // calculate PCM sample value
      lin = (int)(Math.sin(timebase * i) * ampl);
      // convert it to mu-law
      wave[i] = linToMu(lin);
    return wave;
  private static byte linToMu(int lin) {
    int mask;
    if (lin < 0) {
      lin = -lin;
      mask = 0x7F;
    else  {
      mask = 0xFF;
    if (lin < 32)
      lin = 0xF0 | 15 - (lin / 2);
    else if (lin < 96)
      lin = 0xE0 | 15 - (lin-32) / 4;
    else if (lin < 224)
      lin = 0xD0 | 15 - (lin-96) / 8;
    else if (lin < 480)
      lin = 0xC0 | 15 - (lin-224) / 16;
    else if (lin < 992)
      lin = 0xB0 | 15 - (lin-480) / 32;
    else if (lin < 2016)
      lin = 0xA0 | 15 - (lin-992) / 64;
    else if (lin < 4064)
      lin = 0x90 | 15 - (lin-2016) / 128;
    else if (lin < 8160)
      lin = 0x80 | 15 - (lin-4064) / 256;
    else
      lin = 0x80;
    return (byte)(mask & lin);
//                             Applet info
  public String getAppletInfo() {
    String s = "The jazz machine" + LSEP + LSEP +
               "A music synthetizer applet" + LSEP +
               "Copyright (c) Neural Semantics, 2000-2002" + LSEP + LSEP +
               "Home page : http://www.neuralsemantics.com/";
    return s;
  private void setAppletParams() {
    // read the HTML showfreq parameter
    String param = getParameter("showfreq");
    if (param != null)
      if (param.toUpperCase().equals("OFF"))
        showFreq = false;
    // read the HTML backcolor parameter
    bgColor = changeColor(bgColor, getParameter("backcolor"));
    // read the HTML controlcolor parameter
    ctrlColor = changeColor(ctrlColor, getParameter("controlcolor"));
    // read the HTML textcolor parameter
    fgColor = changeColor(fgColor, getParameter("textcolor"));
    // read the HTML fontsize parameter
    param = getParameter("fontsize");
    if (param != null) {
      try {
        fontSize = Integer.valueOf(param).intValue();
      catch (NumberFormatException e) { }
  private Color changeColor(Color c, String s) {
    if (s != null) {
      try {
        if (s.charAt(0) == '#')
          c = new Color(Integer.valueOf(s.substring(1), 16).intValue());
        else
          c = new Color(Integer.valueOf(s).intValue());
      catch (NumberFormatException e) { e.printStackTrace(); }
    return c;
}thanks LIZ
PS If you can help how do I Give the Duke dollers to you

http://www.google.ca/search?q=java+oval+shape+to+plot&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N
Ask the guy who made it for more help

Similar Messages

  • I'm using pages.  How can I change the shape of a text box to arch?

    I'm using pages.  How can I change the shape of a text box to arch?

    You can't do that in Pages. If you need text in an arch use Art text 2 lite, free from the Mac AppStore.

  • How can I change the shape of a photo in iPhoto?

    Can I change the shape of a picture to an oval?

    No. You'd need an external editor for that kind of stuff:
    In order of price here are some suggestions:
    Seashore (free)
    The Gimp (free)
    Graphic Coverter ($45 approx)
    Acorn ($50 approx)
    Pixelmator ($50 approx)
    Photoshop Elements ($75 approx)
    There are many, many other options. Search on MacUpdate or the App Store.
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.
    Of course, you may not want to change the shape of a photo which would distort it. You may want to print it in an oval shape but undistorted. I'd use a page layout app like Pages for that,

  • How can I change the legend of a plot in an excel chart using LabView?

    Hi,
    My question is:
    I create a chart in Excel with LabView7 using ActiveX. There are 4 plots in one chart. How can I rename the legend (the name) of each plot with LabView?
    Thanks.
    Michi

    Use the SeriesCollection(1).Name function. In LV, wire up the following:
    _Chart into Method SeriesCollection (index = 1 to 4)
    Cascade into Variant to Data (wire type Excel.Series)
    Wire Series into Property Name, Write the string
    Michael Munroe
    www.abcdefirm.com
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

  • How can I change where an applet focuses its view

    I'm writing a scrolling marquee applet and in order to scroll up, out of sight or scroll Left out of sight, I have to be able to draw my strings with negative x & y values which seem to not be allowed.
    I figure if I draw my marquee with the upper left corner located at around 300, 50, (instead of 0,0 ) I won't have to worry about drawing to negative coordinates.
    Is there anyway to set the applet so that when it opens in a browser, the upper left hand corner of the visible applet would begin at 300, 50 instead of 0, 0, by default?
    Charlene English

    when the text is at 0,0... it is still in view of the user. 0,0 is, so far, the extreme upper right hand corner of the scrolling marquee. If I wanted the text to scroll off screen to the left, I would have to start assigning negative values to the x component of drawString. This is the reason I want to offset the whole marquee by 300, 50. My Marquee is 350, 30 in size, so if I offset my Marquee without being able to control the view of the applet, I'd have an applet on my page (650, 80) in size and the marquee would be in the lower right hand corner.
    What I'm shooting for is an applet that is (350, 30) in size with it's upper left hand corner located at 300, 50.
    -Charlene

  • Can you please tell me how can i change the parameter of Applet using Aspec

    Respect Members
    Can we apply Aspectwerkz on Applet? In our project we have to
    change the method parameters before its execution(Around Advice) , can we do this in applet using Aspectwerkz?
    Can you please tell me how can i change the parameter of Applet using Aspectwerkz or AspectJ ?
    I did it by for Java Application using the AspectJ And Aspectwerkz But not able to do for Applet.
    For Applet I Am setting the parameter in JAVA plug in for Aspectwerkz e.g. -Xdebug -Xrunaspectwerkz -Xbootclasspath & path for xml file in which pointcut is defined.
    If you any Friend working on it or any author who might be helpfull for me please Forward this mail to him/her
    THANKs in Advance
    [email protected]

    hello rodale, what you're seeing is probably a side effect of firefox not being able to save certain preferences into its profile folder.
    go to ''firefox > help > troubleshooting information'', click on ''profile folder/show folder'' and close all firefox windows afterwards. a windows explorer window should open up - in there delete the file named '''user.js'''.
    in case this didn't solve the issue yet please also refer to [[How to fix preferences that won't save]].

  • How can i change the position and size of the applet

    dear fellows,
    how can i change the position and size of the applet in which form is running over the web.
    thanx
    Mochoo

    Yes, you can add the following line to your formsweb.cfg section :
    HTMLbodyAttrs=onLoad='javascript:self.moveTo(100,100)'
    if you are in SEPERATEFRAME = FALSE
    Or Set_Window_Property( FORMS_MDI_WINDOW, POSITION, X, Y ) ;
    if you are in SEPERATEFRAME = TRUE

  • How can I change the default fill and stroke colors for new shapes?

    As you can see in the following screen recording, after I change the stroke and fill color, all my subsequent rectangles are created respecting these new colors. But then when I delete all the rectangles, choose the rectangle shape tool once again, and start creating new rectangles, they start getting created with another color I had used some time ago (and I don't know how did it become the default color).
    http://tinypic.com/r/64jrwp/6
    So how can I change the defaults, so that the fill color is say #ddd, and the shape has no stroke at all?
    Thanks.

    When you have the shape tool selected you will see in the tool bar below - file edit etc a fill and stroke. This is where you can change the colours.
    You can keep drawing your shapes like you did in the video but then select the rectangle and change the colour from this tool bar. The reason it changes will be because you changed the colours you were using (foreground / background) that display in the left side tool bar.

  • How can I change the colors of a photo?

    How can I change the colors in a photo?

    No. You'd need an external editor for that kind of stuff:
    In order of price here are some suggestions:
    Seashore (free)
    The Gimp (free)
    Graphic Coverter ($45 approx)
    Acorn ($50 approx)
    Pixelmator ($50 approx)
    Photoshop Elements ($75 approx)
    There are many, many other options. Search on MacUpdate or the App Store.
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.
    Of course, you may not want to change the shape of a photo which would distort it. You may want to print it in an oval shape but undistorted. I'd use a page layout app like Pages for that,

  • How can I change my JApplet into a JApplication?

    I am working with a JApplet and am finding that some of my code only works in applications.
    So being new to this, I am clueless as to how to change my Applet into an Application. I understand the difference in definition between the two, but when it comes to looking at Applet Code and Application Code, I am not able to see a difference. (Other than an Applet stating "Applet")
    So, that being said how can I change my code so that it runs as an application and not an applet? Here is my current layout code
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.text.NumberFormat;
    import java.text.DecimalFormat;
    // Creating the main class
    public class test extends JApplet implements ActionListener
         // Defining of format information
         JLabel heading = new JLabel("McBride Financial Services Mortgage Calculator");
         Font newFontOne = new Font("TimesRoman", Font.BOLD, 20);
         Font newFontTwo = new Font("TimesRoman", Font.ITALIC, 16);
         Font newFontThree = new Font("TimesRoman", Font.BOLD, 16);
         Font newFontFour = new Font("TimesRoman", Font.BOLD, 14);
         JButton calculate = new JButton("Calculate");
         JButton exitButton = new JButton("Quit");
         JButton clearButton = new JButton("Clear");
         JLabel instructions = new JLabel("Please Enter the Principal Amount Below");
         JLabel instructions2 = new JLabel("and Select a Loan Type from the Menu");
         // Declaration of variables
         private double principalAmount;
         private JLabel principalLabel = new JLabel("Principal Amount");
         private NumberFormat principalFormat;
         private JTextField enterPrincipal = new JTextField(10);
         private double finalPayment;
         private JLabel monthlyPaymentLabel = new JLabel("  Monthly Payment    \t         Interest Paid    \t \t            Loan Balance");
         private NumberFormat finalPaymentFormat;
         private JTextField displayMonthlyPayment = new JTextField(10);
         private JTextField displayInterestPaid = new JTextField(10);
         private JTextField displayBalance = new JTextField(10);
         // Creation of the String of arrays for the ComboBox
         String [] list = {"7 Years @ 5.35%", "15 Years @ 5.50%", "30 Years @ 5.75%"};
         JComboBox selections = new JComboBox(list);
         // Creation of the textArea that will display the output
         private TextArea txtArea = new TextArea(5, 10);
         StringBuffer buff = null;
         // Initializing the interface
         public void init()
              // Creation of the panel design and fonts
              JPanel upper = new JPanel(new BorderLayout());
              JPanel middle = new JPanel(new BorderLayout());
              JPanel lower = new JPanel(new BorderLayout());
              JPanel areaOne = new JPanel(new BorderLayout());
              JPanel areaTwo = new JPanel(new BorderLayout());
              JPanel areaThree = new JPanel(new BorderLayout());
              JPanel areaFour = new JPanel(new BorderLayout());
              JPanel areaFive = new JPanel(new BorderLayout());
              JPanel areaSix = new JPanel(new BorderLayout());
              Container con = getContentPane();
              getContentPane().add(upper, BorderLayout.NORTH);
              getContentPane().add(middle, BorderLayout.CENTER);
              getContentPane().add(lower, BorderLayout.SOUTH);
              upper.add(areaOne, BorderLayout.NORTH);
              middle.add(areaTwo, BorderLayout.NORTH);
              middle.add(areaThree, BorderLayout.CENTER);
              middle.add(areaFour, BorderLayout.SOUTH);
              lower.add(areaFive, BorderLayout.NORTH);
              lower.add(areaSix, BorderLayout.SOUTH);
              heading.setFont(newFontOne);
              instructions.setFont(newFontTwo);
              instructions2.setFont(newFontTwo);
              principalLabel.setFont(newFontThree);
              monthlyPaymentLabel.setFont(newFontFour);
              displayInterestPaid.setFont(newFontFour);
              displayBalance.setFont(newFontFour);
              areaOne.add(heading, BorderLayout.NORTH);
              areaOne.add(instructions, BorderLayout.CENTER);
              areaOne.add(instructions2, BorderLayout.SOUTH);
              areaTwo.add(principalLabel, BorderLayout.WEST);
              areaTwo.add(enterPrincipal, BorderLayout.EAST);
              areaThree.add(selections, BorderLayout.NORTH);
              areaFour.add(calculate, BorderLayout.CENTER);
              areaFour.add(exitButton, BorderLayout.EAST);
              areaFour.add(clearButton, BorderLayout.WEST);
              areaFive.add(monthlyPaymentLabel, BorderLayout.CENTER);
              areaSix.add(txtArea, BorderLayout.CENTER);
              // Using the ActionListener to determine when each button is clicked
              calculate.addActionListener(this);
              exitButton.addActionListener(this);
              clearButton.addActionListener(this);
              enterPrincipal.requestFocus();
              selections.addActionListener(this);
         }

    baftos wrote:
    Here is one of the sites that explains the procedure:
    [http://leepoint.net/notes-java/deployment/applications_and_applets/70applets.html].
    But maybe you should try to fix the code that does not work as applet?
    Which one is it?
    >Here is one of the sites that explains the procedure:
    [http://leepoint.net/notes-java/deployment/applications_and_applets/70applets.html].
    But maybe you should try to fix the code that does not work as applet?
    Which one is it?
    The code that doesn't work in my applet is the exit button code
    else if (source == exitButton)
                        System.exit(1);
                   }I also can't get my program to properly validate input. When invalid input is entered and the user presses calculate, an error window should pop up. Unfortunately it isn't. I compile and run my applications/applets through TextPad. So when I try to test the error window by entering in invalid info, the applet itself shows nothing but the command prompt window pops up and lists errors from Java. Anyhow, here is the method I was told to use to fix it.
    private static boolean validate(JTextField in)
              String inText = in.getText();
              char[] charInput = inText.toCharArray();
              for(int i = 0; i < charInput.length; i++)
                   int asciiVal = (int)charInput;
              if((asciiVal >= 48 && asciiVal <= 57) || asciiVal == 46)
              else
                   JOptionPane.showMessageDialog(null, "Invalid Character, Please Use Numeric Values Only");
                   return false;
                   return true;
         }My Instructor told me to try the following, but I still can't get it to work.String content = textField.getText();
    if (content.length() != 0) {       
    try {          Integer.parseInt(content);  
    } catch (NumberFormatException nfe) {}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to make a oval shape in java

    how to make an oval shape in java

    here's a simple example:
    import java.applet.Applet;
    import java.awt.Graphics;
    import java.awt.Color;
    /* <applet code="OvalTest" width=83 height=43></applet> */
    public class OvalTest extends Applet {
         public void init() {
              setBackground(Color.white);
         public void paint(Graphics g) {
              g.setColor(Color.blue);
              g.fillOval(1,1,80,40);
    }

  • How can I change the palette of a BufferedImage

    How can I change the palette of a BufferedImage ?
    My image uses an IndexColorModel but I want to use a web safe palette.
    I can't see a way to make a setColorModel() to my image.
    Any ideas ?
    Thanks...

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class ICMExample extends JComponent {
        private BufferedImage original, copy;
        private Point mouseLocation = new Point();
        public ICMExample(BufferedImage original, BufferedImage copy) {
            this.original = original;
            this.copy = copy;
            addMouseMotionListener(new MouseMotionAdapter(){
                public void mouseDragged(MouseEvent e) {
                    mouseLocation = e.getPoint();
                    repaint();
        public Dimension getPreferredSize() {
            return new Dimension(original.getWidth(), original.getHeight());
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.drawRenderedImage(original, null);
            Shape oldClip = g2.getClip();
            g2.clipRect(0, 0, mouseLocation.x, Integer.MAX_VALUE);
            g2.drawRenderedImage(copy, null);
            g2.setClip(oldClip);
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://weblogs.java.net/jag/Image54-large.jpeg");
            BufferedImage original = ImageIO.read(url);
            JComponent app = new ICMExample(original, makeICMVersion(original));
            final JFrame f = new JFrame("Drag mouse over image");
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.getContentPane().add(app);
                f.pack();
                SwingUtilities.invokeLater(new Runnable(){
                    public void run() {
                        f.setLocationRelativeTo(null);
                        f.setVisible(true);
        static BufferedImage makeICMVersion(BufferedImage original) {
            int w = original.getWidth();
            int h = original.getHeight();
            IndexColorModel icm = createICM();
            BufferedImage copy = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_INDEXED, icm);
            Graphics2D g = copy.createGraphics();
            g.drawRenderedImage(original, null);
            g.dispose();
            return copy;
        static IndexColorModel createICM() {
            byte MAX = (byte) 255;
            byte[] r = {MAX, MAX, MAX, MAX, 0, 0, 0, 0};
            byte[] g = {MAX, MAX, 0, 0, MAX, MAX, 0, 0};
            byte[] b = {MAX, 0, MAX, 0, MAX, 0, MAX, 0};
            return new IndexColorModel(3, 8, r, g, b);
    }

  • How can i change character set on forms9i runtime?

    Hi Every Body,
    i am a user on forms9i developer.
    i want to know how can i change character set definition when i run a form on web(with oc4j).
    is it any JAR file or another file that i can change display of characters on forms9i runtime on web?
    thanks a lot.
    f-badiee.

    hi frank,
    thanks a lot for your attention.
    i have a problem on persian language.
    whereas oracle dosn't support persian(farsi) language,
    i use arabic character set for simulation.
    in oracle developer6i (forms) i had no problem about displaying farsi fonts on runtime.
    but in forms9i that runs forms on web(java applet) i can't use farsi fonts correctly.
    for example when i type a word(boilerplate text) on farsi language in form builder i can see it correctly but when i run my forms on web , characters of that word have some displacement.
    i want to know that is there any configuration file for solving this problem?
    thanks a lot.
    be successful.
    f-badiee.

  • If I chose the wrong folder as defaulf for downloads to go to, how can I change it?

    I use download manager. I hit '''yes''' when asked if I wanted to make the folder shown as the default for future downloads of that type. I did not mean to do that. How can I change the default folder?

    Hi belladonna82,
    You should take a look at the [[Downloads window]] and [[Options window - General panel]] Knowledge Base articles. They will give you all the details you need. Unless you are talking about the default action and not the actual download folder? If so, you should look at [[Options window - Applications panel]].
    Hopefully this helps!

  • How can I change the display of Inbox in my iPad's mail app- so that it takes up the full screen?

    How can I change the display of Inbox in my iPad's mail app- so that it takes up the whole screen, as opposed to just about one third; the other two thirds display the full text of the selected email?

    You can't change the display in the Mail app, if you are holding the iPad in landscape orientation then the left-hand third will be for navigation, and the right-hand two-thirds will be an email. If you hold the iPad in portrait orientation then the navigation section becomes a drop-down section.

Maybe you are looking for

  • When I turn on the ipad a box asking for a passcode comes up but it is for entering

    When I now turn on my ipad a box comes up asking for Passcode but it is showing #'s with small letters below like a telephone.  I think I accidentlty pushed a button in Settings that made this happen.  Trying soooo hard to learn the ipad and haven't

  • Bidder Not able to filter Bid Invitations with custom fields

    Dear Community, Need some ABAP help. Know many experts are in our community. We have added 3 custom fields to the Bid Invitation and Bid header Coded Badi BBP_CUF_BADI_2 for them to appear in the Search criteria for Find Bid Invitation for both the l

  • Unable to add new dimemsion members to empty dimension library

    Hi All, I'm installing a development version of HFM 9.3.1 onto Windows Server 2003. Everything seems to have gone OK after carefully following the installation guidelines. The problem i'm getting is not being able to create a new dimension member in

  • Dvt:barGraph how to put anotation text at multiple positions

    We are rendering some data in the form of bargarph using dvt:barGraph. Here we want to achieve couple of usecases which are as following 1) we need to put anotation text at multiple positions on the graph. 2) We are using Reference Objects in the bar

  • Slow profile manager

    Hi gurus! Got a clean install of server 10.7.4 with all updates done. DNS and Opendirectroy are runnung ok and I have no firewall. For some reason, Profile Manager is terribly slow; it takes him up to 10 minutes to update a workstation; is that norma