graphics

Drawing with graphics and with widgets in JApplet/Swing?

荒凉一梦 提交于 2019-12-11 13:04:06
问题 Basically I have a JApplet that tries to draw with the graphics (ie, g.drawOval(10,10,100,100) and also include JCompotents (ie. JButton). What happens is that the repaint can get really wacky. Sometimes the graphics will draw over widgets or vis-versa. It's not reliable and leads to unpredictable behavior. (Button also always be on top of those graphics) I've played around with it trying to override or manually draw components, changing orders, etc, but think I'm missing something very

Centering values in R with ggplot2

故事扮演 提交于 2019-12-11 12:50:17
问题 I am trying to apply this answer to my dataset, but - being a beginner, it isn't working out for me at all. Here is a sample set and sample code: d <- data.frame(Variant = sample(c("iedere","elke"),size = 50,replace = TRUE), Region = sample(c("VL","NL"),size = 50,replace = TRUE), PrecededByPrep = sample(c("1","0"),size = 50,replace = TRUE), Person = sample(c("person","no person"),size = 50,replace = TRUE), Time = sample(c("time","no time"),size = 50,replace = TRUE)) qplot(factor(Variant),

Light-weight winform graphic element substitute of Control

偶尔善良 提交于 2019-12-11 12:47:44
问题 I am interested in creating a drawing element that is super-light weight. Such that I can create millions of these objects without the over-head that is associated with the System.Windows.Forms.Control class. The class in question would inherit from the System.ComponentModel.Component class, and have (I am guessing) only a constructor and a paint(object sender, PaintEventArgs e) method. However, I don't know, how the System.Windows.Forms.Control class performs or facilitates the actual

Drawing a zigzag (Spring) in java

两盒软妹~` 提交于 2019-12-11 12:46:52
问题 I am currently making a program which animates the simple harmonic motion of a mass-spring when it is displaced. I have everything working apart from the fact that instead of drawing something like a spring, my program currently uses the graphics.drawline method to draw a straight line to represent the spring. I ideally want something like this however I am not very experienced with graphics and don't really know how to approach it, I tried to make an algorithm myself but it kept falling

Removing flashiness/ shakiness from scrolling text

假如想象 提交于 2019-12-11 12:30:03
问题 I have finally made a ticker that functions how I want it to, but the only problem now is that it seems kind of shaky and looks like it is being displayed on an old tv. How do I make it look smoother? Here is my code: import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class Scroll1 extends JPanel{ private int x; private int x2; private int y; private int width; private String text; private Font f=(new Font(

JavaFX TreeView: setGraphic() for different levels of treeItem

走远了吗. 提交于 2019-12-11 12:26:40
问题 I'm creating a TreeView that should have different graphics for different levels of the treestructure. It is a 3-level structure, where the root is hidden. The graphic for expandable nodes: http://i.imgur.com/wv00CEi.png The graphic for leaf nodes: Just a label in an hBox. This is what I have tried so far, but I get a nullPointerException basically saying getTreeView is null: CustomTreeCellFactory public final class CustomTreeCellFactory extends TreeCell<String>{ private TextField textField;

Actually changing text size with OCaml Graphics

痴心易碎 提交于 2019-12-11 12:19:19
问题 I was wondering how to set text size in OCaml. I tried Graphics.set_text_size which should do the deal I guess. But whether I put set_text_size 200 or set_text_size 20 doesn't change a thing… 回答1: Graphics.set_text_size is not implemented yet. https://github.com/ocaml/ocaml/blob/trunk/otherlibs/graph/graphics.ml#L165 https://github.com/ocaml/ocaml/blob/trunk/otherlibs/graph/text.c#L36 https://github.com/ocaml/ocaml/blob/trunk/otherlibs/win32graph/draw.c#L350 回答2: maybe for now, Graphics.set

The button on my screen won't switch me towards my game pane

爱⌒轻易说出口 提交于 2019-12-11 12:17:21
问题 The button on my screen won't track me towards my GamePane class. I think it's because of the ActionListener . I have also heard of using a MouseListener but I don't know what that is. GameFrame: The GameFrame holds the component for the game screen. This screen won't show up when the start button is pressed. import java.awt.CardLayout; import java.util.HashSet; import java.util.Set; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing

WPF - C# - Creating and setting image coordinates in code - behind

谁都会走 提交于 2019-12-11 12:07:52
问题 I currently work on WPF application according to my AI interest. I wrote a Uniform Cost Search algorithm (pathfinding) and want to present it in graphical way. Path should be found and show on a graph which could be adjusted by user. I'm quite new in WPF technology, I worked more with WinForms and now have a problem with creating and managing graphical elements. In other words - I want to give opportunity to click on data grid and create your own node (sth like place on a map) which is

Android Graphics: Changing the alpha of just an image (not the background)

假装没事ソ 提交于 2019-12-11 12:06:30
问题 I am a newbie to graphics in Android (although I am pretty well-versed with Android programming itself). I am trying to display a "lightbulb" in my app. Based on some values, I would like to change the "brightness" of the lightbulb. I used a PNG image for this. <View android:id="@+id/view2" android:layout_width="59dp" android:layout_height="65dp" android:background="@drawable/lightbulb" /> And, the code is this: final View normalView = findViewById(R.id.view2); //Where I need to set the alpha