Painting, overlapping and hiding

Hi, guys
I want to write a graphic editor, just like Paint of windows.
JFrame frame : the main frame
JPanel panelWest: the tool bar in the west
JPanel panelNorth: the tool bar in the north
JPanel panelCenter: the main edit panel
JMenuBar menuBar:
and add all the stuff into frame. I did not overwrite the paint() methods for frame, panelNorth,panelWest. On the other hand, I overwrite the paint() for panelCenter, letting it draw something.
Here is the problem: when i draw something in the panelCenter, the other component like menuBar, panelNorth and panelWest will be on the panelCenter. that is there are two menuBar, two panelNorth and tow panelWest.
I tried another way: I use Canvas instead of panelCenter, and the problem above is solved. But another problem rises: the canvas will be on the top of the other components, i.e., when click menu, the menuitems that overlaps with the canvas will be invisible.
Thanks!

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GUI extends JFrame{
     public GUI(){
          Container c=getContentPane();
          JPanel panelWest=new JPanel();
          JPanel panelNorth=new JPanel();
          MyPanel panelCenter=new MyPanel();
          JMenuBar mb=new JMenuBar();
          JMenu m1=new JMenu("File");
          JMenu m2=new JMenu("Edit");
          JMenu m3=new JMenu("Help");
          m1.add(new JMenuItem("Opne"));
          m1.add(new JMenuItem("Save"));
          m1.add(new JMenuItem("Print"));
          m1.add(new JMenuItem("Close"));
          m2.add(new JMenuItem("Copy"));
          m2.add(new JMenuItem("Paste"));
          m2.add(new JMenuItem("Cut"));
          m2.add(new JMenuItem("Delete"));
          m3.add(new JMenuItem("Help Content"));
          m3.add(new JMenuItem("About"));
          mb.add(m1);
          mb.add(m2);
          mb.add(m3);
          setJMenuBar(mb);
          panelWest.add(new JButton("B1"));
          panelNorth.add(new JButton("B2"));
          c.add(panelWest,"West");
          c.add(panelNorth,"North");
          c.add(panelCenter,"Center");
          setSize(300,200);
          show();
     public static void main(String args[]){
          new GUI();
class MyPanel extends JPanel{
     int x;
     int y;
     public MyPanel(){
          setBackground(Color.white);
          addMouseListener(
               new MouseAdapter(){
                    public void mousePressed(MouseEvent e){
                         x=e.getX();
                         y=e.getY();
                         repaint();
     public void paint(Graphics g){
          g.drawRect(x,y,30,30);
}

Similar Messages

  • Using cs6 pencil and my strokes overlaping and dark. how do I stop this?

    using cs6 pencil and my strokes overlaping and dark. how do I stop this?

    Check the tool options bar and make sure the opacity is 100% and the mode is Normal.
    If you need to paint with reduced opacity or a blending mode with either the brush tool or pencil tool, using a separate layer and adjusting the opacity or blending mode of the layer works better.

  • Report painter name and librery name

    Hi,
    Please provide me report painter name and librery name for the output list generated by MC10 transaction.the list is a EXCHANGE BALANE.Please provide me urgently and also its funtionality for breifly.
    Thanks & Regards,
    Radhakrishna.

    Hi RadhaKrishna,
    Report painter/Report Writer
    for designing the reports without programming.
    see the links
    report painter/writer
    Report Writer functions can be accessed from within the Report Painter.
    The difference lies in the GUI of the report painter.
    For Report Painter
    http://help.sap.com/saphelp_47x200/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/content.htm
    For Report Writer
    http://help.sap.com/saphelp_47x200/helpdata/en/66/bc7dc143c211d182b30000e829fbfe/content.htm
    Refer the following links :
    http://www.virtuosollc.com/PDF/Get_Reporter.pdf
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-other/accessing-tables-using-report-painterwriter-98766
    http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_bw31/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm
    Kindly Reward Points If You Found The Reply Helpful,
    Cheers,
    Chaitanya.

  • Import QTVR Files into Corel Painter 11 and export back out to QTVR?

    I received a QTVR File and imported it successfully to corel painter 11 to paint some changes into the frames and I then wanted to export the frames (512 total) back to the QTVR format. Corl painter 11 allowed me to export files as QT, but I did lose the QTVR movie controller. When I tried to go to movie properties in QT pro Version 7 it does not allow me to change the movie properties back to QTVR movie controller. Anyone have any suggestions? I do need to be able to paint in the frames in a digital paint program and then export back out.
    Thanks,
    Fumarole

    can you give me an example of what you are talking about as I 'm new to powershell... and I kind of understand but not sure the syntax of what you said
    Sure, here's an example based on your final data:
    input.csv:
    Period,Time,Date
    p1,t1,2016-01-11
    p1,t1,2017-01-11
    p2,t2,2016-02-11
    p2,t2,2017-02-11
    p3,t3,2016-03-11
    p3,t3,2017-03-11
    p4,t4,2016-04-11
    p4,t4,2017-04-11
    p5,t5,2016-05-11
    p5,t5,2017-05-11
    $p1,$p2,$p3,$p4,$p5 = @()
    Import-Csv .\input.csv | ForEach {
    If ($_.Period -eq 'p1') {
    $p1 += @($_)
    ElseIf ($_.Period -eq 'p2') {
    $p2 += @($_)
    ElseIf ($_.Period -eq 'p3') {
    $p3 += @($_)
    ElseIf ($_.Period -eq 'p4') {
    $p4 += @($_)
    ElseIf ($_.Period -eq 'p5') {
    $p5 += @($_)
    $p1 | Export-Csv .\p1.csv -NoTypeInformation
    $p2 | Export-Csv .\p2.csv -NoTypeInformation
    $p3 | Export-Csv .\p3.csv -NoTypeInformation
    $p4 | Export-Csv .\p4.csv -NoTypeInformation
    $p5 | Export-Csv .\p5.csv -NoTypeInformation
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Photoshop in Adobe RGB 16 bit don't fill a layer with paint bucket and a color 35.40.35.100.

    I create a new file in RGB profile Adobe RGB 16bit
    take the paint bucket and fill the layer with a color created by selector with the following parameters 35.40.35.100 CMYK and RGB corresponds to 24.20.18 the result is a full level of color 76.73.63.9 but in RGB corresponds to 24.20.18 because the values in cmyk not match ??

    Could you please post screenshots (with the pertinent Panels visible) to illustrate the issue?
    Are you not aware that you cannot reliably define a CMYK color in RGB because the transformation is performed through the Profile Connection Space (Lab) and depends on the involved Color Spaces/ICC profiles (edited) and the Color Settings?

  • Text is overlapping and unreadable

    Hi.
    Some webpages I attempt to view have text that overlaps and is unreadable. I have tried fooling around with the preferences (fonts and whatnot) but the problem still exists.
    This is not on all webpages, just some.
    Any solutions?

    I edited my post-- I meant Advanced tab not security tab.
    Your resolution is large enough that even a large font, like Times 16, should not present that much of a problem, normally. And although it seems like your fixed width font should be Monoco, or Courier, I don't think that should affect that page either.
    I went to your first link, first page only (mcsweeneys), set my font to Times 16 and went further and set my minimum font size under the Advanced tab to 18, and still got no overlap. Same at the craigs list link.
    I'm still curious as to what your minimum font is set to in Advanced tab.
    Do you have a personal style sheet set up, maybe, where the fonts are larger, or perhaps something else is set that throws these off-kilter?
    Are you using a third party accessibility or browser enhancement software that may be deploying a style sheet of its own?
    I'm probing just to get some more clues....

  • APPLEWORKS PAINT DPI AND RESOLUTION / IMAGE SIZE

    I am struggling to make a 10" x 10" design in appleworks paint using at least 288 DPI. But the max resolution is 2000 pixels x 2000 pixels. This gives me a tiny square, not 10" x 10". The print shop I want to submit to dictates the size (10 x 10) and wants at least 200 DPI. Is there not some way for me to choose a DPI other than 72, 144, 288, 300 or 360??? I love appleworks paint but this is frustrating.
    I did a 7.5" x 9" design, using 144 DPI @ 1010 x 1300 pixels and it SEEMED to come out fine, but they want higher DPI, and when it was opened as PNG (in an email) it turned out huge.
    What am I doing WRONG?

    Hi,
    Give this a try and see if this works.
    1. Create a custom page size 11x11 using page setup. The extra inch gives you some play with the margins.
    2. Create a drawing document then under the Format menu select the Show ruler command.
    3. Create a paint frame. Activate the paint frame and change the resolution to 288 dpi.
    4. Resize the paint frame to 10x10 by dragging using the frames handles and using the ruler as a guide.
    5. When you have completed the drawing save it as a pdf instead of jpg. If you save it as a jpg the resolution will revert to 72 dpi. If you save is pdf, the paint resolution should be maintained at 288 dpi. To save it as pdf use the print command and use the save pdf under the pdf button. Most print shops should be able to handle pdf.
    Hope this helps.

  • Missing Paint Bucket and Paint Drop

    Good morning,
    I seem to be missing my paint bucket and paint drop.  They are not showing on the icon tool bar.  I have checked in tool icon drop down menu (top left).  I have checked the gradient drop down menu (reached by pressing G when I was in a new document).  Checked in all the option menus Image/layer/type etc and have drawn a blank.  Can anyone help?

    Right-click on the Gradient to see the choices. Or keep pressing Shift+G a few times on the keyboard to tab.

  • Drill Down and Hiding the Previous Column

    Hello Everyone:
    I am trying to know if this is possible at all using OBIEE.
    I have a table with the following drill down:
    Award
         Program
              Department
                   Section Sales, Profit, Costs
    I am able to drill down from award to section just fine. But When I drill down the table gets wider and wider rendering the table unacceptable. Is there away to possibly drill down from 1 to 2 and hiding or not showing 1?
    Drill from Award to Program, but hide award when I am at program level etc…?
    Thank You
    Adel

    Ouch, its a common requirement but sadly not suppoted out of the box.
    I think Goran blogged about 'Navigate in place' but it involves custom iframes etc. so may be a bit of a ballache.
    here it is :
    http://108obiee.blogspot.com/2009/06/same-page-navigation-drills-using-drill.html
    Some other 'nearly there' workarounds exist tho, theres a trick to use a column selector and replace one column with a concatanated <column 1>'-'<column 2> but you'll lose furthur drill functionality, indeed you'd need to configure this for every level,
    I'll try and dig the link out if you interested, its not that tidy though.

  • Overlapping and splitting in routing master.

    Hi...
    I'm setting the PP routing master and using the capacity requirement planning.
    Do you have any definition or document about the overlapping and splitting in routing master ?
    In part of overlapping. There are the options
    - Required overlapping, Optional overlapping, Continuous flow prod
    Could you please explain how does the system calculate the lead time in production when I use the different option together with Min.overlap time or Min. send-ahead qty ?
    Best Regards
    JN

    Hi,
    Refer the SAP help given below it comes with an example & should clarify your query
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/8b/67221404f111d293560000e8323492/content.htm
    Regards,
    Vivek

  • Overlapping and splitting

    Dear All,
    What is Overlapping and splitting, where do i  assign?

    Now
    Splitting
    An operation is split if it is carried out on several machines or by several persons at the same time (see figure).
    Splitting an operation has the following effects on the operation dates:
    The processing time/execution time becomes shorter.
    Setup and teardown must be carried out more than once for the operation
    http://help.sap.com/saphelp_47x200/HELPDATA/EN/7e/d419b7455911d189400000e8323c4f/frameset.htm
    Overlapping
    To reduce the lead time of a routing or production order you can overlap operations. This means that an operation starts before the previous operation has finished
    You can define for each individual operation whether it should overlap with the next consecutive operation and in what way. To do this you can set the following indicators:
    Required overlapping
    This means the operations always overlap
    Optional overlapping
    This means the operations overlap if scheduling uses a reduction level that allows overlapping
    Flow manufacturing
    This means the system extends the lead time of all operations, that overlap using flow manufacturing, to the same length as the lead time of the longest of these operations. As with required overlapping, the operations always overlap.
    For every type of overlapping you can
    Define a minimum overlap time which only allows overlapping after a particular minimum limit has been reached.
    Define a minimum send-ahead quantity to ensure that the operation is performed for a particular minimum quantity of the material to be produced, before the next operation starts.
    http://help.sap.com/saphelp_47x200/HELPDATA/EN/8b/67221404f111d293560000e8323492/frameset.htm
    pavan

  • When I wake my Mac the cursor acts like a paint brush and won't connect to Safari

    When I wake my Mac from Sleep the cursor acts as a paint brush and won't connect to Safari or any App. How do I fix?

    See iPhone DFU mode explained, and how to enter DFU mode.

  • HT1711 Jewel case printing overlaps and is not readable. What is the problem?

    When trying to print the jewel case of a playlist, the printing is overlapped and unreadable.

    Some more things I have tried:
    I purchased a utility called "Printer Setup Repair". I ran all the diagnostics and even replaced the CUPS config file with a brand-new one.
    Strangely, when I try to print, my printer warms-up, the job shows as processing, and then shows as complete. The only thing missing is the actual output - as in a printed page! Yipes.
    If I go to the web-based Admin tool for CUPS, I can resend a job and it fails.
    (yes - I am using several printers - not just the one. Also, it works fine from other systems)

  • Overriding and hiding a method.. the difference?

    hello,
    the text says that "...a subclass cannot override methods that are declared static in the superclass. In other words, a subclass cannot override a class method. A subclass can hide a static method in the superclass by declaring a static method in the subclass with the same signature as the static method in the superclass"
    what does this mean? i don't see the difference between this overriding and hiding of the methods? is it just the concepts??
    what's the difference when i have a non-static method in the superclass overridden by a non-static method in the sub class and when i have a static method hidden by a static method in the subclass?

    over-riding means that you declare an implemenation of some method on the current class that over-rides the implemenation inherieted from your superclass. Over-riding the toString method to print customer data would be a good example- the implemenation on the current class will be invoked, instead of the superclass. Because static methods are bound to a class, rather then instance, they can not be over-ridden. Instead, you can only replace that method with a method of same signature and name. Maybe this code makes it more clear:
    Object arg = MyClass.getInstance();
    //the implemenation of MyClass.toString will be
    //invoked if it is over-ridden, even though Object.toString
    //is being referenced
    arg.toString();But, static methods, like Class.method() and SubClass.method(), have no inherieted functionality- they are totally unique methods that simply share the same name. I'm not sure if this explanation makes it clear or not, but the operative point is, there's no functional relationship between static methods.

  • Dates Overlaps and Gap

    Hi Everyone,
    Can you please help me solve this issue? I have dates overlapping and with gaps. I shouldn't have any overlaps, so I need to split them as below.
    Here is my test data.
      create table test_dates (
        prov_id varchar2(20 byte),
        start_date date,
        end_date date,
    attribute_value varchar2(10 byte)
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-01-01', date '2010-01-31', '1', 'A');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-02-01', date '2010-02-28', '1', 'B');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-04-01', date '2010-04-30', '1', 'C');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-04-15', date '2010-05-31', '1', 'D');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-07-01', date '2010-08-31', '1', 'E');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-07-01', date '2010-07-31', '1', 'F');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-08-15', date '2010-08-01', '1', 'G');
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-09-01', date '2010-12-31', '1', 'H');
    commit;
    Expected Results:
    ID
    START
    END
    1
    1/1/2010
    1/31/2010
    1
    2/1/2010
    2/28/2010
    1
    4/1/2010
    4/14/2010
    1
    4/15/2010
    4/30/2010
    1
    5/1/2010
    5/31/2010
    1
    7/1/2010
    7/31/2010
    1
    8/1/2010
    8/31/2010
    1
    9/1/2010
    12/31/2010

    Hi,
    Depending on your requirements:
    WITH change_points AS
        SELECT  prov_id
        ,       change_date
        ,       change_type
        ,       SUM  (change_type) OVER ( PARTITION BY  prov_id
                                          ORDER BY      change_date
                                        )  AS active_cnt
        ,       LEAD (change_date) OVER ( PARTITION BY  prov_id
                                          ORDER BY      change_date
                                        )  AS next_change_date
        ,       LEAD (change_type) OVER ( PARTITION BY  prov_id
                                          ORDER BY      change_date
                                        )  AS next_change_type
        FROM    test_dates
        UNPIVOT (    change_date
                FOR  change_type  IN ( start_date  AS  1
                                     , end_date    AS -1
    SELECT    prov_id
    ,         change_date      + CASE
                                     WHEN  change_type = 1
                                     THEN  0
                                     ELSE  1
                                 END   AS start_date
    ,         next_change_date - CASE
                                     WHEN  next_change_type = -1
                                     THEN  0
                                     ELSE  1
                                 END   AS end_date
    FROM      change_points
    WHERE     active_cnt   > 0
    AND       change_date  < next_change_date
    ORDER BY  prov_id
    ,         start_date
    Thanks for posting the sample data; that's helpful.
    It also very helpful to explain how you get the results you want from the given data.  For example, what role does prov_id play in this problem?  (It's  hard to guess when every row in the sample data has the same value for prov_id.)  Also, sometimes, the start_dates or end_dates in the output are not exactly the dates in the table; sometimes they are 1 day earlier or later.  How do you decide which?
    In the sample data, start_date can be later than end _date, for example:
    insert into test_dates(start_date, end_date, prov_id, attribute_value) values (date '2010-08-15', date '2010-08-01', '1', 'G');
    Was that a mistake?

Maybe you are looking for