drawString « Graphics « Java Swing Q&A





1. java - why does graphics.drawString() not redraw?    stackoverflow.com

this is beyond me (be forgiving, it's late). I'm subclassing a WindowsSliderUI, because I want it to draw a bigger thumb (is that the right word?)(that's working) and also display the ...

2. java canvas drawstring    stackoverflow.com

I am wanting a string to be drawn at a random position, then jump to a new position but leave an imprint of itself behind. There does not appear to be a ...

3. java drawstring arraylist    stackoverflow.com

If I am using the drawString(String, Int, Int) command in java. How can I store / call different graphics that have been stored in an ArrayList? So, for example,

ArrayList<what type will this ...

4. drawstring on canvas    coderanch.com

You may consider me dense if you like. It seems maybe I haven't communicated my problem very well, or Java is much more verbose than I thought it was. When I run my code above, the expected system.out should be 1st: "I'm at Paint" then second, "I'm at btn 2" however just the oppisite occurs. In order to get around this, ...

5. Why drawString method cannot be print out?    coderanch.com

The code provided isn't even really Java code... Here's a short example that shows how to draw a string in AWT... import java.awt.Canvas; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.Graphics; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class JRPainter extends Canvas { public void paint(Graphics g) { String currentFace = g.getFont().getName(); g.setColor( new Color( 255,255,255 ) ); g.fillRect(0, 0, getWidth(),30); g.setFont(new Font( ...

6. line return in drawString()    coderanch.com

Hello James, Considering that you want a letter & a digit on two separate lines - please remember that the graphics context doesn't work on a line basis. Instead it works on a pixel basis. What this means is that you have to explicitly place your String's where you want them to appear. The modified code below will get you your ...

8. Can you use multiple fonts on multiple text lines (drawString)    coderanch.com

Hi, I am drawing six lines in a panel using drawString. For each line, I allow the user to select if they the text line bold or not. I set the font for each line using setFont(adFont). Problem is, all 6 lines are drawn the same way(bold or not bold, not mixed). Is there any way to do this so you ...

9. drawString Question    coderanch.com





10. Some text issues with drawString    coderanch.com

Ok I'm having some problems with drawString. Here are parts of the code: //g.setColor(new Color(0xffffff)); //g.fillRect(0, 35,400,230); ---------- if (Start == null) doStart(g); <- does a drawString, works fine. if (Sort == null) g.drawString( "Sorted Employee Names", 20,60); --------------- class MyMouseAdapter extends MouseAdapter{ public void mouseReleased(MouseEvent event) { JButton b = (JButton)event.getSource(); if(b == Start) Start = null; else if (b ...

11. drawString method    coderanch.com

13. wrapping in g.drawString(g,x,y)    coderanch.com

14. g.draw() working but g.drawString() is not    coderanch.com

I wanted to draw lines and text on canvas. When I execute the application I am seeing the lines but I am unable to see the text. Code is given here class GraphDisplay extends Canvas { int rectWidth = 480, rectHeight = 480; double graduation=0; double xIncr = (minMaxValues[1]-minMaxValues[0])/10; double curX = minMaxValues[0]; DecimalFormat df91 = new DecimalFormat("####.###"); double yIncr = ...

16. help with drawString    java-forums.org

public class GrdSizeFrame { public GrdSizeFrame() { final JFrame frame = new JFrame(); final int FRAME_WIDTH = 200; final int FRAME_HEIGHT = 250; final int FRAME_X = 500; final int FRAME_Y = 150; frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setTitle("Grid Size"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(FRAME_X, FRAME_Y); JPanel panel4 = new JPanel(); // I've tried a variation of sizes (none worked) WelcomeHeader wHead = new WelcomeHeader(200,250); panel4.add(wHead); frame.add(panel4); ...