Re: JTabbedPane problem
- From: "placid" <Bulkan@xxxxxxxxx>
- Date: 21 Dec 2005 19:25:04 -0800
Knute Johnson wrote:
> placid wrote:
> > BartCr wrote:
> >
> >
> >>Change your paintComponent like this:
> >>
> >> public void paintComponent(Graphics g) {
> >> super.paintComponent(g);
> >> if (mImage == null) {
> >> return;
> >> }
> >> Insets insets = getInsets();
> >> Dimension size = getSize();
> >>
> >> g.drawImage(mImage, insets.left, insets.top, size.width -
> >>insets.left - insets.right,
> >> size.height - insets.top - insets.bottom,
> >>this);
> >> }
> >> }
> >>
> >>other drawImage methods on graphics allow to resize the painted image
> >>while painting
> >>
> >>Bart
> >
> >
> > Your a life saver man, il work on that now so that it only shows the
> > original size of the image.
> >
> > Is it possible to display the image (original size, with no scaling) in
> > a confined space but allow scollbars to scroll the image horizontally
> > and vertically ?
> >
>
> Sure. Put your image JPanel in a JScrollPane and add the JScrollPane to
> the JTabbePane.
>
if implement a MouseListener with my ImagePanel, with the following
code;
public void mouseClicked(MouseEvent e) {
int x = e.getX();
int y = e.getY();
}
the (x,y) co-ordinates will not belong to the Image being display ?
How would i get the pixel co-ordinate that the mouse was clicked at ?
> --
>
> Knute Johnson
> email s/nospam/knute/
.
- Follow-Ups:
- Re: JTabbedPane problem
- From: Knute Johnson
- Re: JTabbedPane problem
- References:
- JTabbedPane problem
- From: placid
- Re: JTabbedPane problem
- From: BartCr
- Re: JTabbedPane problem
- From: placid
- Re: JTabbedPane problem
- From: BartCr
- Re: JTabbedPane problem
- From: placid
- Re: JTabbedPane problem
- From: Knute Johnson
- JTabbedPane problem
- Prev by Date: Re: efficiency of JList setElementAt()
- Next by Date: Re: JTabbedPane problem
- Previous by thread: Re: JTabbedPane problem
- Next by thread: Re: JTabbedPane problem
- Index(es):
Relevant Pages
|