Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35081

Re: What do you think of my CropImage class

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: What do you think of my CropImage class
Date Fri, 22 Jul 2016 10:47:59 -0000 (UTC)
Organization A noiseless patient Spider
Lines 95
Message-ID <nmstkv$fa7$1@dont-email.me> (permalink)
References <87twfk93vu.fsf@Equus.decebal.nl> <8737n36ucx.fsf@Equus.decebal.nl> <nmqj30$boh$1@dont-email.me> <878twu6i0l.fsf@Equus.decebal.nl> <e5b9e305-d209-436d-9885-925ae416aada@googlegroups.com> <87vazy4zm2.fsf@Equus.decebal.nl> <nmr8av$qcu$1@dont-email.me> <87r3am4q2l.fsf@Equus.decebal.nl> <nmrpp8$lfv$1@dont-email.me> <87mvla4dlt.fsf@Equus.decebal.nl> <nms1aq$6jj$1@dont-email.me> <87invy3wnv.fsf@Equus.decebal.nl>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Fri, 22 Jul 2016 10:47:59 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="15687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0hnH797qnetKhxSgZ4lPJpuHa4KcBWiM="
User-Agent Pan/0.140 (Chocolate Salty Balls; GIT 3663720 git://git.gnome.org/pan2)
Cancel-Lock sha1:S+HSG84RrsIxqPeJYyUYqCQdnLc=
Xref csiph.com comp.lang.java.programmer:35081

Show key headers only | View raw


On Fri, 22 Jul 2016 10:27:16 +0200, Cecil Westerhof wrote:

> On Friday 22 Jul 2016 04:44 CEST, Eric Sosman wrote:
> 
>> On 7/21/2016 10:21 PM, Cecil Westerhof wrote:
>>> On Friday 22 Jul 2016 02:35 CEST, Eric Sosman wrote:
>>>
>>>> Okay, I may have misinterpreted your need. However, it looks to me as
>>>> though your difficulty is self-inflicted by your insistence on using
>>>> absolute positioning. If you used a layout manager instead, you'd
>>>> just setPreferredSize() on the image-displaying panel (which might
>>>> well have a null layout manager), and Swing would figure out the
>>>> dimensions of title bars, menu bars, scroll bars, sand bars, stars
>>>> and bars, and all the rest.
>>>>
>>>> But since you want to use absolute positioning, well, ... (Shrug.)
>>>
>>> No, I do not want to use absolute positioning, but without it I did
>>> not get it working. I now use BoxLayout, I am not there yet, but I am
>>> on the right path. I still have a few quirks. I will post those soon.
>>
>> "Good," I think. Letting layout managers do their thing relieves you of
>> worries like "How much room should I leave for borders?" and "Will the
>> amount of border-room be different on other devices or other
>> look-and-feel settings?"
>>
>> YMMV, but speaking for myself: I've used null layout only with panels I
>> treat as "canvases" or "drawing surfaces," panels that display images
>> or vector drawings or other "painted" things as opposed to "contained
>> components." I do not recall ever using a null layout on a top-level
>> container.
> 
> A null layout did not work, but BoxLayout works not completely.
> 
> I have the following code:
>     boolean sameLine = false;
>     setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
>     d.setSize(80, 30);
>     crop.setPreferredSize(d);
>     load.setPreferredSize(d);
>     d.setSize(500, 30);
>     imageInfo.setPreferredSize(d);
>     selectInfo.setPreferredSize(d);
>     add(panel);
>     if (sameLine) {
>         buttons.setLayout(new FlowLayout());
>         buttons.add(crop); buttons.add(load);
>         add(buttons);
>     } else {
>         add(crop);
>         add(load);
>     }
>     add(imageInfo);
>     add(selectInfo);
>     pack();
> 
> With sameLine = false I get:
>     https://drive.google.com/file/d/0BzW5q7uL-6z0eERBS3B1RE1jZEU/view
> 
> There are two things I do not understand:
>     - There is a grey area beside the picture.
>     - The buttons are not exactly the same length.
> 
> But these are minor, so those can wait.
> 
> When I change sameline to false I get:
>     https://drive.google.com/open?id=0BzW5q7uL-6z0em91OW14VW1Qakk
> 
> Here the buttons are on the same line as I want them to be. But there
> are two problems:
>     - The buttons are made very big. They fill the complete line and
>       make it even bigger. I want them have the size of the previous one
>       and displayed like in this picture:
>           https://drive.google.com/open?id=0BzW5q7uL-6z0XzNJb0FSRFFxMDA
>     - imageInfo and selectInfo are moved to the right.
> 
> Why is this happening?
> I would like the buttons displayed as in the third picture and the info
> lines as in the first picture. How would I do that?

This isn't particularly relevant to your cropping project, but if you 
need to build a control panel or some other text oriented panel with 
JLabels, JButtons, JEditorPanes or JTextFields laid out in rows and 
columns, you might find that the se.datadosen.RiverLayout layout manager 
is one of the best suited to this task. I'm really surprised that 
something similar isn't part of the standard JDK. FlowLayout comes close, 
but lacks RiverLayout's tab and linebreak capabilities, which it uses to 
arrange components in left-justified columns and to start new rows of 
components.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-20 09:15 +0200
  Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-20 11:12 +0200
  Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-20 10:02 -0700
    Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-20 21:14 +0200
      Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-20 12:50 -0700
        Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:11 +0200
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 14:19 +0200
      Re: What do you think of my CropImage class Qu0ll <qu0ll64@gmail.com> - 2016-07-21 05:53 +1000
      Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-20 13:46 -0700
        Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-20 13:59 -0700
          Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-20 15:40 -0700
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:27 +0200
            Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 05:17 -0700
              Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 17:43 +0200
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 08:59 -0700
                Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 19:10 +0200
                Re: What do you think of my CropImage class Arne Vajhøj <arne@vajhoej.dk> - 2016-07-23 21:47 -0400
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-25 04:51 -0700
                Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-25 15:01 -0700
                Re: What do you think of my CropImage class Arne Vajhøj <arne@vajhoej.dk> - 2016-07-25 21:06 -0400
                Re: What do you think of my CropImage class Arne Vajhøj <arne@vajhoej.dk> - 2016-07-25 21:09 -0400
            Re: What do you think of my CropImage class Nigel Wade <nmw@local.domain> - 2016-07-21 15:44 +0100
              Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 17:46 +0200
        Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:25 +0200
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 14:16 +0200
    Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:05 +0200
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 13:23 +0200
      Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-21 07:58 -0700
        Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 11:13 -0400
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 18:12 +0200
        Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 17:49 +0200
  Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 11:58 +0200
    Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 09:35 -0400
      Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 09:03 -0700
        Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 12:39 -0400
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 18:07 +0200
        Re: What do you think of my CropImage class Nigel Wade <nmw@local.domain> - 2016-07-21 17:23 +0100
        Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 12:56 -0400
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 19:03 +0200
        Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 10:25 -0700
          Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 14:24 -0400
            Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 11:54 -0700
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 20:25 +0200
            Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 15:37 -0400
              Re: What do you think of my CropImage class Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-21 21:30 +0000
              Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 23:52 +0200
                Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 20:35 -0400
                Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-22 04:21 +0200
                Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 22:44 -0400
                Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-22 10:27 +0200
                Re: What do you think of my CropImage class Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-22 10:47 +0000
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-22 05:16 -0700
                Re: What do you think of my CropImage class Nigel Wade <nmw@local.domain> - 2016-07-22 15:10 +0100
                Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-22 07:47 -0700
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-22 10:21 -0700
    Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-21 08:30 -0700
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 18:19 +0200
        Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 10:18 -0700
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 20:12 +0200

csiph-web