JPanel size setting

I have been programming in java for a while, but haven't done any gui. Lately, I had to develop a gui for my program so i went through the Sun tutorial and have been practicing gui programming for a while. However, I couldn't figure out how to solve my following problem. I did some googling, but haven't been able to find a solution. My problem description is as follows:
I have a JPanel which is added to the JScrollPane and which is added to the JFrame.
I have set a preferred size for the JPanel. I want to draw on this JPanel. Suppose say I am drawing lines.
If the coordinate for the two points of the line exceed the preferred size of the JPanel or the screen size I cannot see the drawings and no JScrollPane. Better explained by the following SSCCE code.
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
public class MainFrame extends JFrame{
     private DrawPanel drawPanel;
     private JScrollPane drawScrollPane;
     public MainFrame(){
          createGui();
     public static void main(String[] args){
          javax.swing.SwingUtilities.invokeLater(new Runnable(){
               public void run(){
                    new MainFrame().setVisible(true);
     private void createGui(){
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setSize(400,400);
          drawPanel = new DrawPanel();
          drawPanel.setPreferredSize(new Dimension(500,500));
          drawScrollPane = new JScrollPane(drawPanel);
          drawScrollPane.setPreferredSize(new Dimension(400,400));
          getContentPane().add(drawScrollPane);
          pack();
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;
public class DrawPanel extends JPanel{
     public void paintComponent(Graphics g){
          super.paintComponent(g);
          Graphics2D g2d = (Graphics2D)g;
          g2d.drawLine(10, 10, 400, 400); //visible
          g2d.drawLine(550,550,650,650); //not visible in default size, but visible in full screen
          g2d.drawLine(2000,2000,2100,2100); // not visible at all
}In my real program, I want to draw few lines, but the maximum coordinates for the lines are not known and it
depends on case by case. In such situation, how could I display drawings? What am i doing wrong?
Any help on what I should be searching for, or any links I should refer to be will be very helpful.
Thank you in advance for any help. If I need to provide more, then please let me know.

My question when I read your post is "why do you wanna see something that is still off screen?"
If you want to see your drawing then you need to scale the drawing to fit the panel. To do this effectively, without much flicker, then using a BufferedImage in addition to the custom painting might help with double buffering (I think Swing primarily takes care of that. I added it just in case, didn't have too much time to test that)
import java.awt.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.swing.*;
public class MainFrame extends JFrame{
    private DrawPanel drawPanel;
    private JScrollPane drawScrollPane;
    public MainFrame(){
        createGui();
    public static void main(String[] args){
        javax.swing.SwingUtilities.invokeLater(new Runnable(){
            public void run(){
                new MainFrame().setVisible(true);
    private void createGui(){
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(400,400);
        drawPanel = new DrawPanel();
        drawPanel.setPreferredSize(new Dimension(500,500));
        drawScrollPane = new JScrollPane(drawPanel);
        drawScrollPane.setPreferredSize(new Dimension(400,400));
        getContentPane().add(drawScrollPane);
        pack();
class DrawPanel extends JPanel{
    BufferedImage bgImage = null;
    public void paintComponent(Graphics g){
        super.paintComponent(g);
        if( bgImage == null || (getWidth() != bgImage.getWidth()) ) {
            bgImage = (BufferedImage)createImage( getWidth(), getHeight() );
        Graphics2D g2d = bgImage.createGraphics();
        // perform image scaling on the buffered to fit panel size
        double maxCoord = 2100;
        double xscale = bgImage.getWidth() / maxCoord;
        double yscale = bgImage.getHeight() / maxCoord;
        g2d.scale( xscale, yscale );
        g2d.drawLine(10, 10, 400, 400); //visible
        g2d.drawLine(550,550,650,650); //not visible in default size, but visible in full screen
        g2d.drawLine(2000,2000,2100,2100); // not visible at all
        g.drawImage( bgImage, 0, 0, this);
}ICE

Similar Messages

  • Newby question: I keep on getting "No size set" error

    Hello,
    I'm trying to integrate an Oracle database into my ASP.NET application and I keep on getting an error:
    "Parameter: ENTITY_NAME. No size set for variable length data type: String"
    The parameter is set as VarChar2 in the database, size 50, and the C# code sets this as a VarChar.
    My ASP.NET code is:
    Connect();
    // setup the command to the stored procedure
    OracleCommand DBCmd = new OracleCommand("HDB.PRL_PAYROLL_PKG.GET_ENTITIYID_BY_STOREID", this.Connection);
    DBCmd.CommandType = System.Data.CommandType.StoredProcedure;
    DBCmd.Parameters.Add("STOREID", OracleType.Number).Value = StoreID;
    DBCmd.Parameters.Add("STOREID", OracleType.Number).Direction = System.Data.ParameterDirection.Input;
    DBCmd.Parameters.Add("HDB_ENTITIES_ID", OracleType.Number).Direction = System.Data.ParameterDirection.Output;
    DBCmd.Parameters.Add("ENTITY_NAME", OracleType.VarChar).Direction = System.Data.ParameterDirection.Output;
    DBCmd.Parameters.Add("ENTITY_NAME", OracleType.VarChar).Size = 50;
    // Execute Procedure.
    OracleDataReader reader = DBCmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess);
    Can anybody steer me in the right direction?
    Thanks in advance for your help.
    Steve

    I have recieved no answers to this question.
    I think I'll go back to SQL Server 2005.

  • Dynamic Calc processor cannot lock more than [100] ESM blocks during the calculation, please increase CalcLockBlock setting and then retry(a small data cache setting could also cause this problem, please check the data cache size setting).

    Hi,
    Our Environment is Essbase 11.1.2.2 and working on Essbase EAS and Shared Services components.One of our user tried to run the Cal Script of one Application and faced this error.
    Dynamic Calc processor cannot lock more than [100] ESM blocks during the calculation, please increase CalcLockBlock setting and then retry(a small data cache setting could also cause this problem, please check the data cache size setting).
    I have done some Google and found that we need to add something in Essbase.cfg file like below.
    1012704 Dynamic Calc processor cannot lock more than number ESM blocks during the calculation, please increase CalcLockBlock setting and then retry (a small data cache setting could also cause this problem, please check the data cache size setting).
    Possible Problems
    Analytic Services could not lock enough blocks to perform the calculation.
    Possible Solutions
    Increase the number of blocks that Analytic Services can allocate for a calculation:
    Set the maximum number of blocks that Analytic Services can allocate to at least 500. 
    If you do not have an $ARBORPATH/bin/essbase.cfg file on the server computer, create one using a text editor.
    In the essbase.cfg file on the server computer, set CALCLOCKBLOCKHIGH to 500.
    Stop and restart Analytic Server.
    Add the SET LOCKBLOCK HIGH command to the beginning of the calculation script.
    Set the data cache large enough to hold all the blocks specified in the CALCLOCKBLOCKHIGH setting. 
    Determine the block size.
    Set the data catche size.
    Actually in our Server Config file(essbase.cfg) we dont have below data  added.
    CalcLockBlockHigh 2000
    CalcLockBlockDefault 200
    CalcLockBlocklow 50
    So my doubt is if we edit the Essbase.cfg file and add the above settings and restart the services will it work?  and if so why should we change the Server config file if the problem is with one application Cal Script. Please guide me how to proceed.
    Regards,
    Naveen

    Your calculation needs to hold more blocks in memory than your current set up allows.
    From the docs (quoting so I don't have to write it, not to be a smarta***:
    CALCLOCKBLOCK specifies the number of blocks that can be fixed at each level of the SET LOCKBLOCK HIGH | DEFAULT | LOW calculation script command.
    When a block is calculated, Essbase fixes (gets addressability to) the block along with the blocks containing its children. Essbase calculates the block and then releases it along with the blocks containing its children. By default, Essbase allows up to 100 blocks to be fixed concurrently when calculating a block. This is sufficient for most database calculations. However, you may want to set a number higher than 100 if you are consolidating very large numbers of children in a formula calculation. This ensures that Essbase can fix all the required blocks when calculating a data block and that performance will not be impaired.
    Example
    If the essbase.cfg file contains the following settings:
    CALCLOCKBLOCKHIGH 500  CALCLOCKBLOCKDEFAULT 200  CALCLOCKBLOCKLOW 50 
    then you can use the following SET LOCKBLOCK setting commands in a calculation script:
    SET LOCKBLOCK HIGH; 
    means that Essbase can fix up to 500 data blocks when calculating one block.
    Support doc is saying to change your config file so those settings can be made available for any calc script to use.
    On a side note, if this was working previously and now isn't then it is worth investigating if this is simply due to standard growth or a recent change that has made an unexpected significant impact.

  • Unable to Set Custom Paper size setting of 15 (width) x 12 (Height) using J

    Hi,
         I am unable to print the report using the custom paper size setting of  15 (width) x 12 (Height)  with printer friendly fonts so that we can print on Line or dot matrix printer.
         This problem is not solved from last 3 months and we dont get help anywhere.
         We are using Java with Crystal Report XI R2 design for the same. 
                           ITable table=null;
    DatabaseController dbCtrl=null;
    ReportClientDocument oReportDoc=null;
    try {
    String reportName=fileName;
    oReportDoc=new ReportClientDocument();
    oReportDoc.open(reportName,0);
    dbCtrl = oReportDoc.getDatabaseController ();
    rs=ad.sqlStringBigST(query);
    table = dbCtrl.getDatabase ().getTables ().getTable (0);
    dbCtrl.setDataSource (rs, table.getName(), "Runtimeres");
    Object oreportSource=oReportDoc.getReportSource();
    IReportSource reportSource=(IReportSource)oreportSource;
    PrintReportOptions printOptions = new PrintReportOptions();
    printOptions.setPrinterName("EPSON FX-2175 ESC/P");
    printOptions.setPaperSize(PaperSize.useDefault);
    options.setPaperSource(PaperSource.manual);
    oReportDoc.getPrintOutputController().printReport(printOptions);
    } catch (Exception e) {
    System.err.println(e.toString());
    Please let me know what is the solution for the same.
    Regards,
    Raj

    Hi,
        Yes i can understand that you need to first understand the root of the problem to give me the solution.
        I am here to answer to your questions until you understand what is the problem.
        Yes if i set the standard page size which are given in API doc , it sets up the page correctly.
        Following page size as given in the API doc works fine.
        http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RAS_SDK/rassdk_java_api_doc/doc/rassdk_java_apiRef/com/crystaldecisions/sdk/occa/report/document/PaperSize.html
       It is rejecting the custom paper size and custom fonts (which in my case are printer friendly fonts).
    Regards,
    Rajshekhar SIpoy

  • Screen Size Setting

    I have installed solaris 10 in the vmware workstation. During the installation, I have updated the screen size to 15 inch, I would like to change the screen size setting to 17 inch now, how could I do that?
    Thanks all in advance

    This forum is to discuss the new container technology in Solaris 10.
    A better place to ask your question would be the general forum
    at
    http://forum.sun.com/forum.jspa?forumID=271

  • VNC/Remote Management display size setting?

    I'm not sure the best place to ask this question, it has several different components involved in it. I've looked all over but can't seem to find any info on this.
    I've got a headless Mini running 10.5.1. When I use a VNC client or now "Share Screen" to it, it comes up with a screen size of 1680 x 1050. Back when it was running Tiger it was something smaller (but can't remember what it was right now).
    Question is... how is this size set and is it changeable?
    Thanks,
    Rich

    Sorry, I guess I should have been more specific, how do you set it to other display sizes besides the ones that are listed in Sys Prefs? What if I want to make it bigger than 1860 x1050 (which is the biggest listed)? I'm connecting from a Mac that has a 30" display, so what if I want to make it closer to that display's size, which is 2560 x 1600? How was 1680 x 1050 even picked in the first place? I do not have a monitor attached at all, let alone that size.

  • The 'Monitor Size' setting could do with an update

    This isn't the most important issue in the world, but I did notice that the 'Monitor Size' setting in Frame 11 (Edit > Preferences > Global > General > Monitor Size) hasn't changed for years.
    It's used so that when you have your screen set to 100% zoom, it matches the real paper world in size.
    But - it just has a drop-down for 'diagonal width" monitor size which assumes a 4:3 aspect ratio (as per old CRT monitors) and only goes up to 22".  I'm currently typing on a 23" 'widescreen' (16:9) monitor so I don't think that diagonal width drop-down is going to do much useful for me

    I presume this setting wasn't fixed in FM12, and still assumes a quaint single-screen 4:3 aspect ratio.
    Back when computers were slower, and I was doing a lot of work with relatively high res TIFFs, I figured out that if I set Monitor Size and zoom levels carefully, I could get specific zoom levels to render raster images at exact integer multiples or fractions of the video card's frame buffer raster dimensions. I found that this made a huge difference in display & refresh performance. At 1:1, doing so apparently eliminated resampling of the image data entirely. At integer 1:N or N:1, it apparently minimized the computation required, and minimized artifacts.
    This sort of consideration is less important today, but it would be nice to get the parameter fixed, or at least publish a FAQ on how to game the 4:3 assumption for 16:9, 16:10 and 21:9 monitors, as well as arbitrary multi-monitor configurations.

  • Customer paper size setting 8.8 in (width)x 5.5 in (height) print out

    Hello, Expert
    I have a question print out paper size that is a customer paper size setting 8.8 in (width)x 5.5 in (height) in Dot-Matrix printer,
    When print out that orientation from protrait to landscape.
    I used CR2008 and upgrade to SP4.
    Hope anybody help me
    Thanks.

    Hi,
    --you just go to file menu and select 'Page setup' option, then it will display new window.
    --In this window you will select the Orientation as 'Landscape' and in page options please specify your required page heigth and width in'vertical' and 'Horizantal' boxes. Then it will display your required page format.
    Thanks,
    Naga.

  • Duplicate Adobe PDF printers won't hold page size setting

    I'm running Acrobat Professional 9.1.1 and 8.1.3 on two separate Windows XP Professional SP3 computers.
    We have an Excel 2003 spreadsheet that we're trying to print to PDF on A4 paper size. When printing from Excel, we select the Adobe PDF print driver, click Properties, then change the Adobe PDF Page Size setting to A4. We double-checked under the Paper/Quality tab to make sure the size stuck, and it did. When it actually finishes creating the PDF, however, it's still Letter sized. The only way to make force it to create A4 is to go into Printers & Faxes and change the default size there...which is way too much work to have to do every time we need to change paper sizes. I would think it would be possible directly within the print dialog box (otherwise, why would they bother including it there?).
    I thought I could do a work-around and duplicate the Adobe PDF print driver with a different name and set the duplicate to A4 size while the regular one would be at Letter size. This works fine when I'm logged in as an administrator. If I log into my computer as a general user however, the duplicate driver shows up, but even when we go into Printers & Faxes and set the paper size to A4, the size doesn't stick when selecting that duplicate print driver when printing from Excel. The same scenario recreates itself on any computer here, whether using Acrobat 8 Pro or Acrobat 9 Pro.
    Any thoughts on this?

    I already described how to get rid of that months ago.
    It rely upon a bit of surgerty.
    ctrl + click the Pages icon to get the menu item "Show package contents"
    Navigate in the package to open the
    <startupVolume>:Applications:iWork '09:Pages.app:Contents:Resources:Templates:
    folder.
    Then, ctrl click the template of your choice .
    You will reach two files :
    index-iso.xml.template
    and
    index-trad.xml.template
    Duplicate both of them for safe.
    Delete the file entitled
    index-iso.xml.template
    then rename
    index-trad.xml.template
    as
    index-iso.xml.template
    As the computers are dumbs, yours will be fooled and will use the file named index-iso.xml.template whose contents will be the index-trad.xml.template one.
    Apply the scheme to every template which you really use.
    If I remember well, I wrote a script applying this process to every templates delivered in the box but I'm too lazy to search for it.
    Yvan KOENIG (VALLAURIS, France)  samedi 12 janvier 2011 16:54:51
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • Unable to set JPanel size in BorderLayout.CENTER

    I have a class that defines a GUI for a paint-type program. This class extends JPanel. Within the class, I add a JMenu, a vertical JToolbar to the WEST, a JPanel to the SOUTH and lastly, I add the JPanel that the user draws on in the CENTER.
    From my understanding of the BorderLayout, the CENTER object will take up the remaining available space. The program is run from an applet (which has a setPreferredSize() but it does not seem to affect anything - I think b/c the size specified for the applet in the HTML override it). Anyway, when I set the size of the applet in the HTML, the JPanel in the SOUTH gets cut off. In order to fit it, I have to make the size of the applet bigger - but that makes my CENTER JPanel too big. I need the CENTER JPanel to be a certain size b/c I'm saving the image - which needs to be a certain size.
    I do not understand why the JPanel SOUTH is getting cut off. The JToolBar on the WEST is not that big that it should be governing the size, rather it seems like that JPanel in the CENTER is. I've tried setPreferredSize() and setSize() for that CENTER JPanel, but neither of them seem to help.
    I'll appreciate any thoughts/suggestions - I can elaborate or send code if needed. Thank you all in advance.

    Try using setMinimumSize() and setPreferredSize() for all the other components in the frame other than the CENTER Jpanel. For example, if you want you applet to be 300 pixel high by 500 pixels wide, and you want the centre panel to be 200 x 400 pixels, set the other components as follows:
    Dimension westPanelSize = new Dimension(100, 300)); // width x height
    westPanel.setMinimumSize(westPanelSize);
    westPanel.setPreferredSize(westPanelSize);

    Dimension southPanelSize = new Dimension(500, 100)); // width x height
    southPanel.setMinimumSize(southPanelSize);
    southPanel.setPreferredSize(southPanelSize);Good Luck!
    - David

  • Problem with jpanel size

    Hi I want to add a view port to a JPanel
    the main problem is that the Jpanel change size as the frame.
    how can i make it independent from the frame so having it; own w, h
    thanks
    package help;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import javax.swing.*;
    public abstract class MyFrame extends JFrame {
    private static final long serialVersionUID = 1L;
    private static JButton drawCircle, drawRectangle, drawSquare, drawStar, start, clear,quit,back, screenshoot;
    static final int FPS_MIN = 0;
    static final int FPS_MAX = 150;
    static final int FPS_INIT = 0;
    static int fps;
    double x1,x2;
    double y1,y2;
    int dr =1;
    int dy= 1;
    int Selection=0;
    boolean click=true; //check if start has been clicked
    int width = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;  // screen width
    int height = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height;     //screen higth
    protected static int count;
    int R,G,B;  //color
    Cursor c;                    //cursor object
    private static ShapePanel bpnl;
    public MyFrame()
            R=G=B=0;
            int width = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;
            int height = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height-100;
            JFrame frame=new JFrame();
            BorderLayout layout=new BorderLayout();
            frame.setLayout(layout);
            frame.setTitle("Game");
            //panel to hold buttons
            JPanel upPanel = new JPanel();
            upPanel.setLayout(new FlowLayout());
            upPanel.setSize(width, height/5);
            //panel to hold SLIDERS
            JPanel leftPanel = new JPanel();
            leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
            leftPanel.setSize(50, height);
            //initialize buttons and add to the upPanel
            drawCircle=new JButton("Draw Circle");
            upPanel.add(drawCircle);
            drawStar=new JButton("Draw Star");
            upPanel.add(drawStar);
            drawRectangle=new JButton("Draw Rectangle");
            upPanel.add(drawRectangle);
            drawSquare=new JButton("Draw Square");
            upPanel.add(drawSquare);
            start=new JButton("Start");
            start.setBackground(Color.GREEN);
            //upPanel.add(start);
            clear=new JButton("Clear");
            upPanel.add(clear);
            back=new JButton("Back");
            upPanel.add(back);
            quit=new JButton("Quit");
            quit.setBackground(Color.red);
            upPanel.add(quit);  
            screenshoot=new JButton("ScreenShoot");
            c = new Cursor (Cursor.CROSSHAIR_CURSOR);     //Change cursor to cross hair
         this.setCursor (c);
            //new object spanel to hold TIMER
            JPanel spanel=new JPanel();
                spanel.setLayout(new GridLayout());
                //slider dimension construction
                JSlider sDimension = new JSlider(JSlider.HORIZONTAL,FPS_MIN, FPS_MAX, FPS_INIT);
                sDimension.setMajorTickSpacing(30);
                sDimension.setMinorTickSpacing(3);
                sDimension.setPaintTicks(true);
                sDimension.setPaintLabels(true);
                Font font = new Font("Serif", Font.ITALIC, 15);
                sDimension.setFont(font);
                sDimension.setBorder(BorderFactory.createTitledBorder("Shape Dimension"));
                //slider speed construction
                int FPS_MIN_s = 0;
                int FPS_MAX_s = 60;
                int FPS_INIT_s = 0;    //initial frames per second
                JSlider sSpeed = new JSlider(JSlider.HORIZONTAL,FPS_MIN_s, FPS_MAX_s, FPS_INIT_s);
                sSpeed.setBorder(BorderFactory.createTitledBorder("Shape Speed"));
             ////////////////////////// // slider colors////////////////////////////////////////////////////
                int FPS_MIN_C = 0;
                int FPS_MAX_C = 250;
                int FPS_INIT_C = 0;  
                JSlider sliderR= new JSlider(JSlider.HORIZONTAL,FPS_MIN_C, FPS_MAX_C, FPS_INIT_C);
                sliderR.setBorder(BorderFactory.createTitledBorder("Red Channel"));
                JSlider sliderG= new JSlider(JSlider.HORIZONTAL,FPS_MIN_C, FPS_MAX_C, FPS_INIT_C);
                sliderG.setMajorTickSpacing(50);
                sliderG.setMinorTickSpacing(25);
                sliderG.setPaintTicks(true);
                sliderG.setPaintLabels(true);
                sliderG.setFont(font);
                sliderG.setBorder(BorderFactory.createTitledBorder("Green Channel"));
                JSlider sliderB= new JSlider(JSlider.HORIZONTAL,FPS_MIN_C, FPS_MAX_C, FPS_INIT_C);
                sliderB.setBorder(BorderFactory.createTitledBorder("Blue Channel"));
              //     spanel.add(sSpeed,BorderLayout.EAST);
                  frame.add(upPanel,BorderLayout.NORTH);
                  frame.add(leftPanel,BorderLayout.WEST);
                  bpnl = new ShapePanel(3000,3000);
                        System.out.println("panel width = "+bpnl.getWidth() +"  heigth = " + bpnl.getHeight());
                        bpnl.setFocusable(true);
                  upPanel.setBackground(Color.DARK_GRAY);
                  upPanel.setBorder(BorderFactory.createLineBorder(Color.white));
            frame.add(spanel,BorderLayout.SOUTH);       
            frame.add(bpnl, BorderLayout.CENTER);
            frame.setSize(width, height);
            frame.setVisible(true);               
               leftPanel.add(sliderR);
               leftPanel.add(sliderB);
               leftPanel.add(sliderG);
               leftPanel.add(sDimension,BorderLayout.WEST); 
                 System.out.println("panel width = "+bpnl.getWidth() +"  heigth = " + bpnl.getHeight());
              public static  int getPanelWidth()
                  System.out.println("panel width   "+bpnl.getWidth());
                  return bpnl.getWidth();
              public static  int getPanelHeigth()
                  System.out.println("Panel heigth  " +bpnl.getHeight());
                  return bpnl.getHeight();
              public static void main(String args[])
                  new MyFrame() {};
    package help;
    import java.awt.Cursor;
    import java.awt.Graphics;
    import javax.swing.JPanel;
    class ShapePanel extends JPanel  {
         private static final long serialVersionUID = 1L;
         private javax.swing.Timer animationTmr;
         private float heigth;
         private float width;
         private Cursor c;
         public ShapePanel(int w, int h) {
                    int W=w;
                    int H=h;
                    c = new Cursor (Cursor.CROSSHAIR_CURSOR);     //Change cursor to cross hair
                    this.setCursor (c); 
                    this.setPreferredSize(3000,3000);
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              g.fillRect(0, 0, this.getWidth(), this.getHeight());
        private void setPreferredSize(int i, int i0) {
        thanks

    sorry i hope this is better
    package help;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public abstract class MyFrame extends JFrame {
    private static final long serialVersionUID = 1L;
    int dr =1;
    int dy= 1;
    int Selection=0;
    int width = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;  // screen width
    int height = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height-100;     //screen higth
    private static ShapePanel bpnl;
    public MyFrame()
            JFrame frame=new JFrame();
            BorderLayout layout=new BorderLayout();
            frame.setLayout(layout);
            bpnl = new ShapePanel(3000,3000);
            System.out.println("panel width = "+bpnl.getWidth() +"  heigth = " + bpnl.getHeight());
            bpnl.setFocusable(true);
              frame.add(bpnl);
            frame.setSize(width, height);
               pack();
            frame.setVisible(true);               
    System.out.println("panel width = "+bpnl.getWidth() +"  heigth = " + bpnl.getHeight());
              public static  int getPanelWidth()
                  System.out.println("panel width   "+bpnl.getWidth());
                  return bpnl.getWidth();
              public static  int getPanelHeigth()
                  System.out.println("Panel heigth  " +bpnl.getHeight());
                  return bpnl.getHeight();
              public static void main(String args[])
                  new MyFrame() {};
    package help;
    import java.awt.Cursor;
    import java.awt.Graphics;
    import javax.swing.JPanel;
    class ShapePanel extends JPanel  {
         private static final long serialVersionUID = 1L;
         private Cursor c;
         public ShapePanel(int w, int h) {
                    int W=w;
                    int H=h;
                    c = new Cursor (Cursor.CROSSHAIR_CURSOR);     //Change cursor to cross hair
                    this.setCursor (c); 
                    this.setPreferredSize(3000,3000);
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              g.fillRect(0, 0, this.getWidth(), this.getHeight());
        private void setPreferredSize(int i, int i0) {
       

  • Save Image size setting in Save for Web

    I'm using Save for Web (CS3) and scaling the file to different sizes with "scale image". I'm wanting to use the same scale settings for many images but when I save the pre-set the image size settings don't get saved. I'm wanting to use it as part of an action but the setting wont stick. Any suggestions? Alternative work flows?

    That's never been saved as part of the S4W presets. Bloody annoying.

  • Calendar in Yosemite does not comply to Sidebar icon size setting?

    The icon size and the font size in the sidebar of System apps can be set in
    System Prefs => General => Sidebar icon size
    The Finder of OS X 10.10 does react to this setting, Mail.app does and in Mavericks also Calendar.app did.
    On my MBP running Yosemite, Calendar v8.0 always shows quite large icons and a large font in the sidebar.
    Is this a problem of my installation, or is it "normal"?
    There are other problems of the Calendar sidebar, for example I am unable to enlarge the sidebar to show longer names of individual calendars.

    If you want the calendar entries that you create on the phone to sync with the gmail, you need to create the entry in the gmail calendar on the phone.  If you create it in the phone calendar, it is only on the phone.
    Usually at the very top of the new event entry you have a choice of which calendar to create this event in.  Either Phone, gmail or any other option you have synced to your phone.  To get it to sync to the gmail calendar you need to select the gmail calender.

  • The printer page size setting is not working in Photoshop 5.1 with Xerox printer

    I am attempting to print an output size larger than 8.5 x 11 and Photoshop will not change the size even though the printer setting is now at the larger size.  Illustrator and other programs will print but but Photoshop fails.  This is an issue in both the 32 and 64 bit versions.  Help!

    I found the following on the Xerox site...tip of the hat to T Robinson:
    Re: Photoshop CS6 on Win 7x64 prints only letter size on Workcentre 7655
    03-20-2013 12:28 PM
    We have a Xerox WorkCentre 7435 PCL6, and I have been having a similar problem. I found a workaround in Photoshop CS5, which I will describe in case it is helpful to others. I just upgraded to Photoshop CS6 however, and the workaround no longer works with it. Instead I get an error message if I print a Job History Report. The message is partially cut off at the right margin of the page, but the part I can read says, "Completed with error(016-799): Print Instructi...on Fail detected in Decomposer." (The ellipsis indicates the part of the message that is cut off. What follows it appears on the next line down. I downloaded all updates to CS6 to see if that would help, but it did not.
    Here is the workaround that worked for me on CS5:
    1) Click on "Print Settings" in the Print dialog
    2) On the pulldown Paper menu, select "Advanced Paper Selection"
    3) Select the tray where your tabloid (or legal) sized paper is loaded
    4) Click on the button at the right end of the "Paper Size" field to display the Paper Size dialog.
    5) Click on the down arrow button at the right end of the "Original Document Size" field and select "Tabloid" (or "Legal") from the menu.
    6) Click OK to close each of the open dialogs til you get back to the Print dialog and then print your document. The print preview should update to show you a preview reflecting the selected paper size. (This may take a few seconds to happen.)
    This worked for me in CS5. Unfortunately, as noted above, it does not seem to work in CS6. The only workaround I can come up with for CS6 is to save the file as a PDF and then print it from Acrobat. This works without a problem, but it's a lot of trouble to go to every time I have to print something other than letter size.
    If anyone finds a better workaround in CS6, please let me know.

  • How do I Keep the "zoom" size setting the same each time I open Safari and from web page to web page?

    I have a 27" iMac when I open Safari the web page is only 1/3 the size of the full screen Safari window. I know how to ZOOM in on the web page! My question is, How do I keep this ZOOM setting for all web pages and each time I open Safari up?

    Sorry, but that's not possible.
    An alternative might be to use Zoom in System Preferences > Accessibility
    Or try a different screen resolutioin in System Preferences > Displays > Scaled

Maybe you are looking for

  • How to make the combobox column in grid can be selectable

    Hi, I have a grid in a form and use a SQL query as the data source. Now I want to make a column(a field in a SQL query) to be displayed as combobox and user can select it. I tried to use below code to make the column displayed like a combobox, it see

  • Gmail issue

    A colleague and both use iPads, iPhones and MacBook Pros. We are working on a website where we both need to use Gmail accounts. We have both successfully set up our individual accounts our our iPads and iPhones and I have also done this on my MacBook

  • Sales order should get block if XYZ payment terms is used

    Dear Expert, The requirement is like, If user add payment term XYZ  manually in salse order then that sales order should get block for review purpose. Note: if user add that payment term in sales order client want that order should block no matter wh

  • Calling DLL from ABAP (BSP) in the background

    Hello, We are developing a picture upload webpage (BSP). When uploading the picture has to be checked for certain attributes. This can be done by a dll supplied by a supplier. The dll has as input the location of the image (on the server) and returns

  • Create GR with with RG23D using BAPI or FM

    Hi,   We are using the 'BAPI_GOODSMVT_CREATE' to create the GR with this, the GR is created properly, I want to know along with creating the GR can we capture the excise inovice with BAPI, for depot plant. there si one BAPI 'BAPI_EXCINV_CREATE_FROMDA