Draw « Applet « Java Swing Q&A





1. Java applet not drawing correctly    stackoverflow.com

Here is the main code

import java.awt.*;  

import javax.swing.*;  
import java.awt.event.*;  
import java.applet.Applet;  

import java.applet.*;  
import java.awt.image.*;  
import java.util.*;  
import java.net.*;  
public ...

2. How to clear and redraw in JApplet    coderanch.com

4. Drawing on an applet    coderanch.com

5. JApplet drawing printing    java-forums.org

package freeHandDrawJappletInternalFrame; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PrintApplet2 extends JApplet implements ActionListener { Graphics2D g2; CanvasPrint2 fdc; @Override public void init(){ this.setLayout(new BorderLayout()); JPanel panel = new JPanel(); this.add(panel); Button print = new Button("Print"); print.addActionListener(this); fdc = new CanvasPrint2(); panel.add(fdc,BorderLayout.NORTH); panel.add(print,BorderLayout.SOUTH); } @Override public void actionPerformed(ActionEvent e) { } } class CanvasPrint2 extends Canvas { public CanvasPrint2() { ...

6. Applet GUI (but being drawn from another class)    forums.oracle.com

/*// bronze JLabel bronze = new JLabel("000.00"); bronze.setBounds(((187*maxSlots)/2)-99, 14 ,100, 50); bronze.setFont(new Font("LCD", Font.PLAIN, 19)); bronze.setForeground(Color.red); add(bronze); // silver JLabel silver = new JLabel("000.00"); silver.setBounds(((187*maxSlots)/2)-54, 45 ,100, 50); silver.setFont(new Font("LCD", Font.PLAIN, 25)); silver.setForeground(Color.red); add(silver); // gold JLabel gold = new JLabel("000.00"); gold.setBounds(((187*maxSlots)/2)-20, 9 ,200, 50); gold.setFont(new Font("LCD", Font.PLAIN, 35)); gold.setForeground(Color.red); add(gold); // background ImageIcon = new ImageIcon(getImage(getCodeBase(), "Images/topbox.gif")); imageLabel = new ...