Re: JTabbedPane problem




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/

.



Relevant Pages

  • Re: JscrollPane to display a changing image
    ... On 10 mar, 17:08, Knute Johnson ... need to call revalidateon your JLabel after you change theimagein ... public void actionPerformed{ ... the ones that relates to the jScrollPane (the ones I get if I only ...
    (comp.lang.java.programmer)
  • Re: Revolving TextArea???
    ... On Mar 9, 10:18 am, Knute Johnson ... int strLen = str.length; ... super.insertString(offs, str, a); ... public class LengthLimitedDocument extends PlainDocument { ...
    (comp.lang.java.programmer)
  • Re: Scaling an Image to Print on 1 page
    ... On Dec 3, 2:36 pm, Knute Johnson ... scale it to fit on one page. ... drawImage(Image img, int x, int y, int width, int height, ImageObserver ... int bimgNewW = conversion*tempW; ...
    (comp.lang.java.programmer)
  • Re: Counting Chars Within Strings
    ... On Jan 31, 1:51 pm, Knute Johnson ... int vowel = 0; ... pos = String1.charAt; ...
    (comp.lang.java.programmer)
  • Re: How can I get the input from keyboard without using swing?
    ... using namespace std; int main{int a,b; cout>a>>b; ... Can I use java to get the input from the keyboard like this without using the GUI? ... Knute Johnson ...
    (comp.lang.java.help)