Sort of miss Java Applets, myself, as they were once “the thing” for some people writing code for the web. You got used to paint() and repaint() methods because you could imagine, word for word, codewise, what was happening.
So here is another tutorial that uses Swing functionality in Java to create a GUI (Graphical User Interface) desktop program on a Mac laptop (but same code may well work, compiled on a Windows laptop (the same way)) that harkens back to those Java Applet ideas drawing graphics (we even use “repaint()” … yay) that is a simple Java JFrame object, graphics for a Line Graph, accepting co-ordinate input from the (Linux) command line arguments or taking this interactively via the JOptionPane showInputDialog() method, and then, optionally, later you can add to your Line Graph via mouse clicks understood as vertices of the one continuous line you are creating … in other words, not scribble, that would require different logic, but not that much more difficult or involved logic actually … would just involve some intervention with the onmousemove event function.
Some of the points of interest, and you may want to see our previous relevant Java Swing JTree Primer Tutorial as shown below, as well, are:
- Is a desktop Java application that uses a Java Swing JFrame GUI framework
- Is a desktop Java application that uses a Java Swing JPanel GUI object
- Is a desktop Java application that uses a Java Swing JOptionPane showInputDialog() method to obtain the interactive input required
- It implements Mouse event functionality via MouseListener
- It uses a kludgy-feeling approach to drawLine() work by drawing the one line with five drawLine() calls to give the impression of a thicker line
Download programming source code and rename to LineChart.java that has the very simple command line compilation procedure:
javac LineChart.java
java LineChart
Of great help was this link and this link … and the general idea and code ideas also came from Developing Java Entertainment Applets by John Withers … thanks heaps.
Previous relevant Java Swing JTree Primer Tutorial is shown below.
Here is another tutorial that uses Swing functionality in Java to create a GUI (Graphical User Interface) desktop program on a Mac laptop (but same code may well work, compiled on a Windows laptop (the same way)) that tests the use of a simple Java JTree object, adding to the thought processes, perhaps, of the previous Java Swing Sound Primer Tutorial as shown below.
Some of the points of interest, and you may want to see our previous relevant Java Swing Desktop Primer Tutorial as shown below, as well, are:
- Is a desktop Java application that uses a Java Swing JFrame GUI framework
- It uses a private JTree object in which to store the hierarchical data … in our case the lineage (up to 5 generations) of Falleur’s Nelson the Golden Retriever … yes, dog
- Is a desktop Java application that uses a Java Swing JOptionPane showInputDialog() method to obtain the interactive input required
Download programming source code and rename to TreeUsage.java that has the very simple command line compilation procedure:
javac TreeUsage.java
java TreeUsage
Of great help was this link … thanks heaps.
Previous relevant Java Swing Desktop Primer Tutorial is shown below.
Here is another tutorial that uses Swing functionality in Java to create a GUI (Graphical User Interface) desktop program on a Mac laptop (but same code may well work, compiled on a Windows laptop (the same way)) that tests the use of a Java programmatical desktop environment allowing a button ActionListener event to control when it adds another internal frame to its programmatic desktop environment, adding to the thought processes, perhaps, of the previous Java Swing Sound Primer Tutorial as shown below.
Some of the points of interest, and you may want to see our previous relevant Java Swing ActionListener KeyListener Primer Tutorial as shown below, as well, are:
- Is a desktop Java application that uses a Java Swing JFrame GUI framework, with original ideas coming from Introduction to Java 2 Training Manual for WEA Sydney by Phil Cogar today
- It implements Mouse event functionality via ActionListener
- Is a desktop Java application that uses a Java Swing JButton and JDesktopPane and JInternalFrame GUI objects
Download programming source code and rename to JDeskTop.java that has the very simple command line compilation procedure:
javac JDeskTop.java
java JDeskTop
Of great help was this link … thanks heaps.
Previous relevant Java Swing Sound Primer Tutorial is shown below.
Here is a tutorial that uses Swing functionality in Java to create a GUI (Graphical User Interface) desktop program on a Mac laptop (but same code may well work, compiled on a Windows laptop (the same way)) that tests the use of the Java system sound beep() method using a button ActionListener event to control when it starts.
Some of the points of interest, and you may want to see our previous relevant Java Swing ActionListener KeyListener Primer Tutorial as shown below, as well, are:
- Is a desktop Java application that uses a Java Swing JFrame GUI framework, even though the original idea came from a JApplet idea in Introduction to Java 2 Training Manual for WEA Sydney by Phil Cogar (now that JApplets are so out of favour we did a Swing desktop solution, here, today)
- It implements Mouse event functionality via ActionListener
- Is a desktop Java application that uses a Java Swing JPanel and JButton and JLabel GUI objects
- Can only handle the song’s rhythm, because frequency of sound is a more complex problem, so we’ve gone back to that first piano lesson with our Middle C song (believe it or not, this first piano lesson was totally devoted to thumbwork, and this song, if my memory serves me well)
Download programming source code and rename to JSound.java that has the very simple command line compilation procedure:
javac JSound.java
java JSound
Of great help was this link and if you want to look further into playing Happy Birthday for instance:
- Java Sound, Creating, Playing, and Saving Synthetic Sounds – Developer.com
- Thanks to this link regarding
String hbstuff[] = {
"hap","C4","262","0.5","sec",
"py","C4","262","0.5","sec",
"birth","D4","294","1","sec",
"day","C4","262","1","sec",
"to","F4","349","1","sec",
"you","E4","330","2","sec",
"hap","C4","262","0.5","sec",
"py","C4","262","0.5","sec",
"birth","D4","294","1","sec",
"day","C4","262","1","sec",
"to","G4","392","1","sec",
"you","F4","349","2","sec",
"hap","C4","262","0.5","sec",
"py","C4","262","0.5","sec",
"birth","C5","523","1","sec",
"day","A4","440","1","sec",
"dear","F4","349","1","sec",
"so","E4","330","1","sec",
"so","D4","294","3","sec",
"hap","B4b","466","1","sec",
"py","B4b","466","1","sec",
"birth","A4","440","1","sec",
"day","F4","349","1","sec",
"to","G4","392","1","sec",
"you!","F4","349","2","sec"
};
Here is some information from Wikipedia regarding the Java Swing functionality.
Previous relevant Java Swing ActionListener KeyListener Primer Tutorial is shown below.
Here is a tutorial that uses Swing functionality in Java to create a GUI (Graphical User Interface) desktop program on a Mac laptop (but same code may well work, compiled on a Windows laptop (the same way)) that tests your typing speed skills. As you can imagine, in order to measure your performance we’ll need to code for Keyboard events, via KeyListener and Mouse events, via ActionListener.
Some of the points of interest, and you may want to see our previous relevant Java Swing OptionPane Primer Tutorial as shown below, as well, are:
- Is a desktop Java application that uses a Java Swing JFrame GUI framework
- It implements Keyboard event functionality via KeyListener
- It implements Mouse event functionality via ActionListener
- Is a desktop Java application that uses a Java Swing JPanel and JButton and JTextArea (one with a JFrame parent and one with a JPanel parent) and JLabel (with a JFrame parent) GUI objects
- Use of Java class BigDecimal for the purposes of presenting a String representation of a double rounded to one decimal place
Download programming source code and rename to TypingSpeed.java that has the very simple command line compilation procedure:
javac TypingSpeed.java
java TypingSpeed
Here is some information from Wikipedia regarding the Java Swing functionality, and here are some practitioners … chortle … chortle.
Previous relevant Java Swing OptionPane Primer Tutorial is shown below.
Here is a tutorial that uses Swing functionality in Java to create a GUI (Graphical User Interface) program on a Mac laptop that displays calculator program performing +-*/^! Below is some information from Wikipedia regarding the Java Swing functionality:
Swing is the primary Java GUI widget toolkit. It is part of Oracle’s Java Foundation Classes (JFC) — an API for providing a graphical user interface (GUI) for Java programs.
Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit (AWT). Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform. It has more powerful and flexible components than AWT. In addition to familiar components such as buttons, check boxes and labels, Swing provides several advanced components such as tabbed panel, scroll panes, trees, tables, and lists.
Unlike AWT components, Swing components are not implemented by platform-specific code. Instead they are written entirely in Java and therefore are platform-independent. The term “lightweight” is used to describe such an element.[citation needed]
This program works a rudimentary calculator for +-*/^! functionality.
Let’s see some Java Swing code for this, and how it works …
Download programming source code and rename to Calculator.java
But of course regarding all the information above It Don’t Mean A Thing (if it ain’t got that swing).
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.