Drawing a box with now fill and an outline

I know this is simple, but I it's driving me crazy. Using the rectangle tool how do you draw a box with: an outline and no fill, and an outline with a different color fill. thanks

public class Flags3 extends JFrame {
    public Flags3() {
        setContentPane( new JPanel() {
            public void paintComponent(Graphics g) {
                int w = getWidth();
                int h = getHeight();
                int x = 0;
                int y = 0;
                System.out.println("Width:"+getWidth()+" Height: "+getHeight());
                for (int i=0; i<100; i++) {
                    Color newGrey = Color.getHSBColor(150, 0, i/100.0f);
                    g.setColor(newGrey);
                    g.fillRect(0, (h/100)*i, w, (h/100));
        Dimension size = new Dimension(800, 600);
        getContentPane().setPreferredSize(size);
        getContentPane().setMinimumSize(size);
        getContentPane().setMaximumSize(size);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    public static void main(String[] args) {
        new Flags3();
}I wrote this mainly to make sure I wasn't giving you bad info, but I also improved your paint method a little bit. It's a JFrame instead of a JApplet, so you'll have to make some changes, but it gives the full range of black to white (although it doesn't include full brightness white, the B value only goes to .99).

Similar Messages

  • Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke

    ID-CS3
    Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke. Is there a way to fix and have the graphic resize using the fill size without redrawing the shape? Something like expand appearance?
    I'm not looking for a workaround or to redraw the shape. This problem description was used to present the simplest explanation to recreate the problem.

    I'm not sure I understand your question/problem, but if I make a box with an outside stroke and assign a stroke color, then... invert the stroke and fill, the stroke gets redrawn as a centered stroke --- it is no longer an outside stroke.
    This seems to me to be incorrect behavior, but it's more likely I just don't understand *why* this happens.
    Tad

  • TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM

    Hi,
       How to draw a table with multiple rows and columns seperated by lines in form printing?

    check this
    http://sap-img.com/ts003.htm
    Regards
    Prabhu

  • SAP-Script - Draw Table (Boxes) with variable number of lines

    Hello,
    I want to create a Table with Frames in a SAP-Script Form. First of all I don´t know the position of the table in the window main. It can be page 2 or 3 on top or in the middle. But i have to describe a position like
    POSITION YORIGIN '12.95' CM.  How can i position the table in a variable way?
    And i don´t know the number of lines of the table. How can I manage to draw the correct numbers of boxes as numbers of lines exist?
    Kind Regards
    Carsten Fuchs

    Hi carsten,
    1. Drawing GRID (just like excel, matrix)
       is very cumbersome in sapscript layout.
      (either dynamically, or hardcoded)
    2. Moreover, the final look,
       may or maynot appear as requried,.
      ie. exactly with proper alignment and grid lines.
    3. If the font size is required to change,
      then the dynamic position also changes.
    4. If the grid is supposed to go to the next page,
      again the calculation and logic becomes tougher.
    5. To use grid, its better to use smartform,
       which provided FINE CONTROL of the grid
      and its lines and width, height, style etc.
    6. In sapsctip, at most we can use
       UNDERLINE (_) and PIPE (|)
    regards,
    amit m.

  • Issue with Color Fills and Multiply?

    Hi,
    I use Photoshop 7.0, and yesterday I started having an issue with Color Fills.
    (You may actually have to Say I have a black-and white lineart on the background layer, such as
    this. I double-click on the background layer to make it edit-able.
    I click on the Color Fill button, choose solid color, then pick any color (say we use bright red). I go back to the lineart, move the Color Fill layer to underneath the lineart layer, and fill the Color Fill with black. Normally, it would just create white, however for me it has pink/light red. The same thing also happens for patterns and gradients; it leaves a very faded version of the color on the picture.
    I didn't change any options or settings, however my little brother was playing around with Photoshop, and he may have changed something. Can anyone tell me how to get it so that there is no pink or faded color there?
    Thanks in advance.

    One quick way to fix this is to hold down crtl-alt-shift while Photoshop
    starts up, and reset your prefs to their factory defaults. This will not
    lose any of your work.
    The other way is to look through your various settings. Top of the list is
    whether your new files are being created in RGB or CMYK mode. It should be
    RGB.

  • Acquire with NOWAIT error and TRUNCATE command

    Why is it that, sometimes when i try to TRUNCATE a table. I would get
    ORA-00054: resource busy and acquire with NOWAIT specified error. And i would be able to DELETE the same table using DELETE FROM table_name;
    Message was edited by:
    C. Boutet

    Because some other session has a lock on that table, you can delete it because you are in fact deleting your read consistent view of the table. See this test case:
    In session 1:
    YAS@10G>create table t as select * from dual;
    Table created.
    YAS@10G>insert into t values(2);
    1 row created.In session 2:
    YAS@10G>truncate table t;
    truncate table t
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified
    YAS@10G>delete from t;
    1 row deleted.
    YAS@10G>commit;
    Commit complete.
    YAS@10G>select * from t;
    no rows selectedI was not able to truncate it because session 1 inserted a row and it is holding a lock on the table. I could delete from the table because the rows I want to delete are not locked.
    TRUNCATE is DDL and it needs an exclusive lock on the table. Session 1 is holding a shared lock on the table which does not permit the other session to get an exclusive lock.

  • How to move R12 apps-tier to another box with same hostname and a new IP ?

    Hi , we want to move R12 apps-tier to another box with same hostname,same application paths and a new IP. What is the best way? SR recommends cloning but I am seeking for a short way,Thanks.

    Hi , we want to move R12 apps-tier to another box with same hostname,same application paths and a new IP. What is the best way? SR recommends cloning but I am seeking for a short way,Thanks.Cloning is the best approach.
    You could simply copy all the files (without running preclone), clean FND_NODES and bring the services up.
    How to Clean Nonexistent Nodes or IP Addresses From FND_NODES [ID 260887.1]
    How to get a clean Autoconfig Environment ? [ID 391406.1]
    You would still need to relink the executable files as per the docs in this thread -- Need clarification on Solaris 10 upgrade for E Business suite application
    Again, I would recommend cloning as it is the easiest/shortest method.
    Thanks,
    Hussein

  • I can't draw straight lines for fill-in-the-blank on my tests and worksheets. The "draw it yourself choice makes big fat lines and takes a lot of manipulation. Do I have to draw them myself with a pen and a ruler?

    I can't draw straight lines for fill-in-the-blank on tests and worksheets. The draw-it-yourself ooption gives me thick lines and is time-consuming. So, after all these years, do I have to go back to using a ruler and a pen?

    In Pages v5.0.1, the straight lines are already drawn for you in the Shape Tool. Before we go there, select Menu > View > Show Ruler.
    When you click on Shape in the Pages toolbar, the top left line is straight. Click it. It will drop into your document in a 45 degree angle. Grab the lower left selection grip and drag it up and to the right to position the horizontal line in the length of your choice. Use the Format: Style tab to manage the stroke weight. You can also choose Menu > Edit > Duplicate Selection (command+D) as a productivity tool.
    If you move from the Format: Style tab to the Arrange tab, you can compare the start and end points with where you want the line positioned on the ruler. Once you have it positioned, notice the Lock button, also on the Format: Arrange tab.

  • MDIChildren flickering problem while switching between child form with dockstyle.fill and borderstyle.none

    I have an mdi applicaton in Visual studio 2010 (.Net framework 4.0). I'm having a flickering problem when user switch between an MDI Child form. I'm declaring the child form then setting the borderstyle.none at design time and dock property to fill
    through programming and make them a MDIChildren before I show them so that it takes up the entire space of the MDI Parent window without being maximized (client request). 
    i don't want to display control box(minimize, maximize,close) of child form in mdi parent form. (client request)
    The problem is that when the child form is being displayed it is briefly shown in it's default size with icon and control box before being resized to fill the available area on the MDI Parent form. When a Child Form loads, you can see it in it's original
    size (the size from Design-time) then all this flickering while maximizing .
    In other words, child form show up in the client area of the MDIForm, not maximized, with a caption, very shortly, before they are finally filling the client area. there is a short flicker when a new form is created and displayed. This process is most noticeable
    with a not-so-powerful PC or there are lots of control inside child form.
    below is my code to show child form 
       MyChild1 c1 = new MyChild1();
                                c1.MdiParent = MdiMainParent;
                                c1.Dock = DockStyle.Fill;
       c1.Show(); 
    how can i solved the problem of flickering issue?
    I tried many options which i have described below
    1.double buffering.
    2.set style property to child form
          this.SetStyle(ControlStyles.UserPaint, true);
          this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
          this.SetStyle(ControlStyles.DoubleBuffer, true); 
    3. override below method in each child form
    protected override CreateParams CreateParams
                get
                    CreateParams cp = base.CreateParams;
                    cp.ExStyle |= 0x02000000;
                    return cp;
    4. override below method in each child form
      const int WM_NCPAINT = 0x85;
            const int WM_SIZE = 0x05;
            protected override void WndProc(ref Message m)
                if (m.Msg == WM_NCPAINT)
                    if (this.WindowState == FormWindowState.Maximized)
                        return;
                if (m.Msg == WM_SIZE)
                    if (this.WindowState == FormWindowState.Maximized)
                        return;
                base.WndProc(ref m);
    but I didn't see any effects.  please someone help me to resolve flickering issue. thanks in advance.

    Hi hardikvaishnav,
    This is a known issue which has been reported to Microsoft Connect. Unfortunately, this issue will not fix due to stability issues around MDI. For more details, see 
    https://connect.microsoft.com/VisualStudio/feedback/details/97787/border-of-mdi-child-form-flashes-up-despite-formborderstyle-none.
    You might use a user control or panel instead.
    Best Regards,
    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

  • Inner shadow box with paper fill overprinting?

    (Mac Pro 4,1 / 2.66 GHz Quad/12G InDesign: CS6 / Ver. 8.0.2)
    I have 2 boxes filled with paper and Inner shadow effect with black (created in InDesign), Background is a 4 color linear gradient (left is 4c green, middle is paper, right 4c green) from Illustrator.
    The Inner shadow box that is close to the top of gradient (more green than white) is ok.
    The Inner shadow box that sits on the paper fill of the gradient, appears to be overprinting, thus no paper fill.
    I have check fills of the Inner shadow box in InDesign, to make sure it is not overprinting.
    I have tried some tricks but nothing works.
    Ideas anyone?

    I found the solution:
    You should never use white as a color in a gradient. I have always been told to use 5-10% of the gradient color.
    This gradient create in Illustrator using:
    left is 4c green, middle is paper, right 4c green
    Solution:
    Duplicated the green and made a spot
    modified gradient to:
    left 4c green, middle 8% of Spot green, right 4c green
    Been a few years and I forgot prepress 101, white is not a color and should never be used in a gradient.
    Hope this helps someone in the future.
    Thank you Leonie15

  • How to draw a box with transparent background ?

    Hi there,
    I want to do an effect where after I display the text, there will be drawing effect where it draws a rectangle around the text ?
    During the days of Final Cut Express, I bought plugins from LiveType, it has effects to do this.
    But dow to I do this now in FCPX ?
    Thanks

    Thanks Jim,
    It is a good tips that LiveType still works on Maverick !
    Now I gotta ransack my store room to look out for the LiveType dvd/disc ...
    Motion ? I thought Motion is very difficult to learn ... more difficult than After Effects ?
    Ok, i better look out for some tutorials on Motion then ... Motion can integrate with FCPX ?
    I just checked, the Motion that I have is Ver 5.0.7 (got this as a birthday gift). Is this compatible with Maverick ?
    Thnaks
    Jim Wanamaker wrote:
    A couple of thoughts. Livetype still works in Mavericks although I don't know about your plugins. You would have to try them. Obviously you can not send a livetype project to FCP X, but you could design your title and export it and then import to FCP X. That should work although you couldn't make any changes in FCP X. A second thought is to use Motion if you have it. You can easily create a title in Motion to do what you want by opening a title template, add and format text. Then add a bezier shape for your rectangle and use the write on behavior. Very simple to do.

  • Image box with opacity gradients, and other parallax scrolling inhancements

    First i want to say great job Muse Team, this is starting to get really interesting:
    I've been playing around with parallax scrolling over gradients for effect,   but i'm dreaming about fading in full screen fields of texture.   without the weight of massive .png
    1)      I would love to see the Background Image folder persist in the rectangle Fill > Gradient menu, with the options to tile etc.
    2)     This feature along with speed and rotation controls for anchor finding, would really crack this thing wide open for me.    
    could be implemented with 2 lines coming off anchors:
    one line straight down that can be rotated like a hand on a clock, to set the landing orientation.
    and the second a diagonal line (thinking photoshop curves), to set the approach speed.
    Maybe holding shift with the hand tool could rotate the design page, though i have no idea what rotation would do to the exhisting scrolling menu, i guess ill leave implementation to you!  
    3)     One last tweak, the option to remove scroll bars entirely from the page properties menu would be nice, but intil then i found this bit of code for the bleeding edge:
    Insert as HTML to hide the horizontal scrollbar:
    <style>
    html,body{
    overflow-x:hidden;
    </style>
    thanks for your time

    Be sure your images are stacked properly in the order you need them in your Layers panel.
    If that doesn't solve your problem please provide a link or screenshots so we can see your problem.

  • White box with QT logo and '?"

    HI,
    I've uploaded a QT movie to my website. It previews ok in dreamweaver although when I check online I get a QT place holder with a '?' inside. I'm using IE, I've tried Firefox but it made no difference. I've uninstalled and reinstalled QT latest versions. Anyone know how to solve the problem, it's driving me nuts.
    Any help appreciated.

    Well I'm going to bed..gotta be up at 5 am..hopefully they fix it by then and crossing my fingers that I can get stuff back in morning!
    Thanks phil

  • Has anyone had problems in v5.0a of Iplanet calendar installed on a Sun box with creating events and daylight savings time?

    Events created around 4/6/2002 at 8pm get created with the wrong time (9pm) and there are several other creation and display problems tied to Daylight Savings in April and October. Version 5.1 of the software seems to fix that but we are looking for a fix until we can upgrade. We have been using Windows systems to access the calendar.
    Thanks.

    We have not seen exactly this, but many users appointments are lining up in the wrong time slots. Also, when scheduling, the time display is off by an hour. We have found what looks like a temporary fix.
    We noticed that the problem only affects users who have the start of the week set to Sunday (when daylight savings time started). Setting the week to start on Monday fixed our display problems (you can do it in the users, options section).
    I am placing a support call w/SUN.

  • Drawing a Box with many rectangles inside

    I've been trying to make an applet that has 100 equally defined rectangles going across. They will have different shades going from light to dark. This is what I have gotten so far:
    import java.applet.Applet;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Graphics2D.*;
    import java.awt.Rectangle;
    import java.awt.BasicStroke;
    import java.awt.Color;
    public class Flags3 extends Applet
         public Flags3()
         public void paint(Graphics g)
              int w = getWidth();
              int h = getHeight();
              int x = w-w;
              int y = h-h;
              Graphics2D g2 = (Graphics2D)g;
              System.out.println("Width:"+getWidth()+" Height: "+getHeight());
    int i;
    int grayy = 250;
              for ( i=1; i<100; i++)
                        Color newGrey = new Color(0,0,0,grayy);
                        g2.setColor(newGrey);
                        Rectangle bar = new Rectangle (x,(h/100)*i, w, (h/100)*i);
                        g2.fill(bar);
                        grayy = grayy - 6;
    }I want it to look like this but with 100 rectangles instead of the 5.
    http://img339.imageshack.us/my.php?image=boxxi9.jpg
    Why does the rgb values have 4 integers instead of 3? Also can anyone recommend a good java book for beginners.
    Thanks for the help.
    Message was edited by:
    ButcherBay
    Message was edited by:
    ButcherBay

    public class Flags3 extends JFrame {
        public Flags3() {
            setContentPane( new JPanel() {
                public void paintComponent(Graphics g) {
                    int w = getWidth();
                    int h = getHeight();
                    int x = 0;
                    int y = 0;
                    System.out.println("Width:"+getWidth()+" Height: "+getHeight());
                    for (int i=0; i<100; i++) {
                        Color newGrey = Color.getHSBColor(150, 0, i/100.0f);
                        g.setColor(newGrey);
                        g.fillRect(0, (h/100)*i, w, (h/100));
            Dimension size = new Dimension(800, 600);
            getContentPane().setPreferredSize(size);
            getContentPane().setMinimumSize(size);
            getContentPane().setMaximumSize(size);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            setVisible(true);
        public static void main(String[] args) {
            new Flags3();
    }I wrote this mainly to make sure I wasn't giving you bad info, but I also improved your paint method a little bit. It's a JFrame instead of a JApplet, so you'll have to make some changes, but it gives the full range of black to white (although it doesn't include full brightness white, the B value only goes to .99).

Maybe you are looking for

  • How do I add my radio staion to itunes radio?

    We stream a 24/7 internet radio station, currently available on our website and also available on TuneIn Radio and ooTunes.  How do we get our stream added to iTunes Radio?  Thanks, sdensler

  • Web ADI Configuration Error

    Hi, We are getting the following error. Web ADI Configuration Error BNE_UIX_PHYSICAL_DIRECTORY is not configured. FPRIVATE "TYPE=PICT;ALT=http://hostname.domainname:port/OA_HTML/cabo/images/t.gif" I followed the below thread http://kr.forums.oracle.c

  • Input field in Web Dynpro ALV does not have correct focus

    Hello Friends, Our client's SAP system is recently upgraded with ECC 6.0 SP 18. After that the focus in the editable field of Web Dynpro ALV does not working properly by down arrow navigation. The common scenario: The ALV has more than one rows and o

  • ORA-02291

    0. Am using these products: Forms [32 Bit] Version 10.1.2.0.2 (Production) Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

  • BSP-System:logoff & Pop-Up-Killer

    Hello, we use the BSP "SYSTEM" to logon/logoff from our SAP WebAS. One of our Web-User has a software instaled on his PC that prevents Pop-Up's on Web-Pages (WebWasher) - eBAY ranks on #1 on my own list Now the logout mechnism does not work anymore f