graphics

Drawing tree not visible; maybe layout issue

落爺英雄遲暮 提交于 2020-01-07 00:33:32
问题 I want to display a tree. But the tree does not appear. What is the problem? Main: package scanner_parser; public class Main { public static void main(String[] args) { Oberflaeche gui = new Oberflaeche(); gui.setVisible(true); } } GUI: import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.*; import javax.swing.*; public class Oberflaeche extends JFrame implements ActionListener { private JPanel cp, top, bottom; private JTextField eingabefeld = new JTextField(); private

How to draw multiple ellipse in the same panel

两盒软妹~` 提交于 2020-01-07 00:06:29
问题 I am trying to draw some ellipse in the same panel, and the coordinators are determined by mouse click. Here is my code, this code can only draw one circle. The newer circle is always updating the older circle on the panel. So there is always only one circle. private void panel1_MouseDown(object sender, MouseEventArgs e) { x = e.X; y = e.Y; panel1.Invalidate(); } Graphics g; private void panel1_Paint(object sender, PaintEventArgs e) { g = panel1.CreateGraphics(); g.FillEllipse(Brushes.Red, x

How to draw multiple ellipse in the same panel

て烟熏妆下的殇ゞ 提交于 2020-01-07 00:05:30
问题 I am trying to draw some ellipse in the same panel, and the coordinators are determined by mouse click. Here is my code, this code can only draw one circle. The newer circle is always updating the older circle on the panel. So there is always only one circle. private void panel1_MouseDown(object sender, MouseEventArgs e) { x = e.X; y = e.Y; panel1.Invalidate(); } Graphics g; private void panel1_Paint(object sender, PaintEventArgs e) { g = panel1.CreateGraphics(); g.FillEllipse(Brushes.Red, x

PictureBox Zoom Mode Effect With Graphics Object

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 23:48:02
问题 When you load an image into a PictureBox there is a zoom for the image placement, how do I achieve that same effect with a graphics object? 回答1: I think you mean you want to draw some Image yourself in a Rectangle and using some Graphics object like as the PictureBox renders its Image in Zoom mode. Try the following code. I suppose you want to draw the Image on a Form, the drawing code should be added in a Paint event handler of your form: //The Rectangle (corresponds to the PictureBox

How do I make it so that my MousePressed listener only respons when I click in a certain area?

别说谁变了你拦得住时间么 提交于 2020-01-06 19:27:16
问题 I have created a simple GUI that has 2 circles and 2 squares. When the mouse is clicked the shapes change to a random colour. I would like my shapes to only change colour when the mouse has been clicked inside a shape. Also, at the moment all 4 shapes change colour but I wish for each shape to change colour independently depending on which shape is clicked. package weekThree; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java

Writing Name Using Bezier Curves In C#

蓝咒 提交于 2020-01-06 16:44:31
问题 I have to make a program that uses C# Generated Graphics to make a replica of my name that I wrote in cursive. Twist is, I have to use Bezier Curves. I've already called a function to make Bezier Curves using 4 points and a gravity concept. My question to you is, What would be the easiest way to make around 10 curves. Here is my function for a Bezier Curve. public static void bezierCurve( Graphics g, double p1x, double p1y, double p2x, double p2y, double p3x, double p3y, double p4x, double

Writing Name Using Bezier Curves In C#

為{幸葍}努か 提交于 2020-01-06 16:44:08
问题 I have to make a program that uses C# Generated Graphics to make a replica of my name that I wrote in cursive. Twist is, I have to use Bezier Curves. I've already called a function to make Bezier Curves using 4 points and a gravity concept. My question to you is, What would be the easiest way to make around 10 curves. Here is my function for a Bezier Curve. public static void bezierCurve( Graphics g, double p1x, double p1y, double p2x, double p2y, double p3x, double p3y, double p4x, double

Animation: how to “roll” circle down the y-axis

家住魔仙堡 提交于 2020-01-06 16:07:21
问题 Here is the entirety of my program. The problem is in the ballroll method, getting the red dot/ ball to move straight down the screen on the y-axis to reach the inner blue circle for a "ripple effect" illusion. Please help me do this. I changed the code from the ball moving along the x axis, it needs to move vertically only. Thank you in advance for your help. import java.awt.Color; import java.awt.Graphics; public class Animation { public static void main(String [] args) { DrawingPanel panel

Animation: how to “roll” circle down the y-axis

别等时光非礼了梦想. 提交于 2020-01-06 16:05:55
问题 Here is the entirety of my program. The problem is in the ballroll method, getting the red dot/ ball to move straight down the screen on the y-axis to reach the inner blue circle for a "ripple effect" illusion. Please help me do this. I changed the code from the ball moving along the x axis, it needs to move vertically only. Thank you in advance for your help. import java.awt.Color; import java.awt.Graphics; public class Animation { public static void main(String [] args) { DrawingPanel panel

Animation: how to “roll” circle down the y-axis

萝らか妹 提交于 2020-01-06 16:04:53
问题 Here is the entirety of my program. The problem is in the ballroll method, getting the red dot/ ball to move straight down the screen on the y-axis to reach the inner blue circle for a "ripple effect" illusion. Please help me do this. I changed the code from the ball moving along the x axis, it needs to move vertically only. Thank you in advance for your help. import java.awt.Color; import java.awt.Graphics; public class Animation { public static void main(String [] args) { DrawingPanel panel