Arrow « Graphics « Java Swing Q&A





1. Help Needed for drawing arrow in Java Swing...    bytes.com

HI.. I need to link 2 JTree's using an arrow. For the line i used separator. But i couldnt draw an arrow. Can somebody help with this. Either help me draw ...

2. drawing arrows    coderanch.com

import java.awt.*; import java.awt.geom.*; import javax.swing.*; public class Arrows { public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new ArrowPanel()); f.setSize(500,400); f.setLocation(200,200); f.setVisible(true); } } class ArrowPanel extends JPanel { int barb; double phi; public ArrowPanel() { barb = 20; // barb length phi = Math.PI/6; // 30 degrees barb angle setBackground(Color.white); } protected void paintComponent(Graphics g) ...

3. Draw an arrow head on the end of a line    coderanch.com

I suppose this could end up being a geometry question as much as a Java question but here goes. I want to draw a number of lines on a Canvas object. If for each line I have a start (x,y) value and an end (x,y) value what is the easiest way to draw an arrow on the endpoint? Is there a ...

4. how to draw an arrow mark using java swing    java-forums.org

Java Code: import java.awt.*; import java.awt.geom.*; import javax.swing.*; import javax.swing.event.*; public class Arrow extends JPanel implements ChangeListener { Path2D.Double arrow = createArrow(); double theta = 0; public void stateChanged(ChangeEvent e) { int value = ((JSlider)e.getSource()).getValue(); theta = Math.toRadians(value); repaint(); } protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int cx = getWidth()/2; int cy = getHeight()/2; AffineTransform ...