paint

Simulating brush strokes for painting application

被刻印的时光 ゝ 提交于 2019-12-02 16:24:25
I'm trying to write an application that can be used to create pictures that look like paintings using simulated brush strokes. Are there any good sources for simple ways of simulating brush strokes? For example, given a list of mouse positions that the user has dragged the mouse through, a brush width and a brush texture, how do I determine what to draw to the canvas? I've tried angling the brush texture in the direction of the mouse movement and dabbing several brush texture images along the path, but it doesn't look great. I think I'm missing something where the brush texture should shrink

How to export one to one JTable in the pdf [duplicate]

北城余情 提交于 2019-12-02 16:23:37
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Why does the JTable header not appear in the image? Drawing JTable rows and columns on a Panel I am working on a report application in which I have to export a JTable in the form of report. But when I try to directly paint JTable on the PDF, it doesn't show the 1st row and column border. For this I tried by using default color grid Left Top borders. Which gives me a darker line in the PDF. However when try to

Implementing smooth sketching and drawing on the <canvas> element

穿精又带淫゛_ 提交于 2019-12-02 15:44:30
I am trying to create a drawing area with canvas. I am having trouble with making the lines look smooth when drawing curves and I also have changing line thickness in my algorithm which looks bad as well because the size jumps to much as well and you can see where the size changed. I did find this link on stackoverflow but this was for a native iPhone app and I can't figure it out. Here is my current JS code. and Here is it running on jsFiddle var xStart, xEnd, yStart, yEnd, paint, ctx; $(document).ready(function (){ ctx = $('canvas')[0].getContext("2d"); ctx.strokeStyle = '#000'; ctx.lineJoin

Repaint does not update the screen

主宰稳场 提交于 2019-12-02 14:48:01
问题 I would like to repaint my screen. As of now all it does is show the first screen with a dot where the head is supposed to be. This is fine, however I've written in my code that I want to move the head down 10 pixels every second. I'm printing at what point the head is supposed to be at, and in the command prompt it shows that the y value is indeed increasing. However on my screen the head is not moving. I have tried using the revalidate method, trying to extend the canvas class instead of

why can't I draw any stuffs on Frame in java?

回眸只為那壹抹淺笑 提交于 2019-12-02 13:10:40
Coding is here. I can't create any rectangle or circle inside frame. the object of this project is to create converting celcius 2 Farenheit & Farenheit 2 Celcius. so what I want is, please teach me to how to draw rectangle or oval in side the frame. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import

why Java repaint() method not working?

試著忘記壹切 提交于 2019-12-02 12:36:57
问题 The code below is a very simple test which involves an image. It should repaint an image whenever I send "a" to System.in and it should exit the program whenever I send "q". The problem is that only the exit works: the method paint() is never called, and I don't why. I checked for the call to "super.paint()", tried replacing paint(Graphics g) with paintCompoenent(Graphics g) but nothing seems to work: simply there's no call. Is the problem involving the Scanner in main()? The path in the

Repaint does not update the screen

不打扰是莪最后的温柔 提交于 2019-12-02 12:11:22
I would like to repaint my screen. As of now all it does is show the first screen with a dot where the head is supposed to be. This is fine, however I've written in my code that I want to move the head down 10 pixels every second. I'm printing at what point the head is supposed to be at, and in the command prompt it shows that the y value is indeed increasing. However on my screen the head is not moving. I have tried using the revalidate method, trying to extend the canvas class instead of jframe, I have tried using different classes just for the paint method, i have tried replacing the paint

How do I apply a color to a single bar of my single series graph?

帅比萌擦擦* 提交于 2019-12-02 11:25:43
问题 I am new to JFreeChart and I am trying to see what action do what. In my chart I only have one series, and I would like -according to the value- to set a different color for the bar. For example : 0-20 -> RED, 20-80 -> YELLOW, 80-100 -> GREEN CategoryPlot plot = chart.getCategoryPlot(); CategoryDataset dataset = plot.getDataset(0); Number value = dataset.getValue(dataset.getRowKey(0), dataset.getColumnKey(0)); Double val = value.doubleValue(); if (val <= 20.0) { BarRenderer renderer =

Painting to panel after .Update() call

左心房为你撑大大i 提交于 2019-12-02 11:00:56
I have a problem when trying to draw to a panel immediatly after calling a panel.Update(); Here's the code: public void AddAndDraw(double X, double Y){ AddPoint (X, Y); bool invalidated = false; if (X > _master.xMaxRange) { _master.Update (); invalidated = true; } if (Y > _master.yMaxRange) { _master.Update (); invalidated = true; } if (!invalidated) { _master.UpdateGraph (this); } else { _master.PaintContent (); } } When running this problem I only see the cleared panel and not he content I'm trying to paint in the .PaintContent()-method. I've already tried using .Invalidate() and .Refresh()

Post overriding the paint method of the components in java

a 夏天 提交于 2019-12-02 10:08:44
In java awt or swing when you want to change painting of some component you usually have to override the method paint(Graphics g) (in awt) or paintComponent(Graphics g) (in swing). This is usually (maybe allways - I'm not sure) done when you are creating the component for example: JPanel jPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; //... my implementation of paint, some transfromations, rotation, etc } }; Imagine that you have container of components which could for example consists of some JLabels, some