Questions tagged [setbounds]

In `Java`, `setBounds()` is a method that resizes swing components

In Java, setBounds() is a method that resizes swing components with the syntax (x-dimension, y-dimension, width of component, height of component). setBounds() is a hybrid of setSize() and setLocation(). The (x,y) location is relative to the parent of the component.

75 questions
1
vote
2 answers

Make UIImageView image slightly smaller

I would like to make my image in UIImageView slightly smaller than it originally set for me. I had send the contentMode to UIViewContentModeScaleAspectFill but I still want to make it slightly smaller. self.imgCamera.layer.cornerRadius =…
1
vote
1 answer

Have Winform appear on all existing monitors at same time (Its an alert window)

I have a small application which functions as an alert system, I am using a form as the alert which appears on the screen, as they are more versatile and message boxes. Due to the nature of the alert, I need it to appear in the centre of all…
bob
  • 209
  • 1
  • 2
  • 12
1
vote
1 answer

Is setBounds() called in the EDT?

Is the setBounds() method of a Component like JPanel called on the Event Dispatch Thread? I am asking this because I am writing a program that draws platforms and uses a Swing Timer to move them up. I override the setBounds() method so that every…
JayKay
  • 183
  • 1
  • 3
  • 14
1
vote
1 answer

Trying to get google maps to zoom and center, can't get my head round it

I've got a piece of code here that plots a group of paths on a map. I'm trying to get the map to zoom and centre so all the paths are visible, but I can't get anything to work. Here's what the code looks like before I started: var points = new…
1
vote
1 answer

How to set the size of a panel inside a panel with null layout?

I have a main panel using a null layout and I want to add three more panel in it but I want those three panels to automatically resize upon loading of the main panel. I cant use layout managers since I will be dragging those three panels. I tried…
John
  • 836
  • 2
  • 25
  • 39
1
vote
1 answer

Set center of a drawable at a point

In a custom view, is there a way I can set the center of a drawable at a certain point on the canvas? (I don't want to deal with figuring out rectangular bounds for the drawable...)
ElectronAnt
  • 2,115
  • 7
  • 22
  • 39
1
vote
3 answers

How do I set the size of a JButton that already has a background image?

Every time I create a JButton with an image constructed to it, it sets the JButton's size to a size slightly larger than the Image's size. I tried to use button.setBounds(x,y,width,height), and then repainted the button after this, but it did not do…
keyert
  • 255
  • 1
  • 4
  • 12
0
votes
1 answer

Change bounds origin + cropping an image

I am a newbie to Cocoa, I have a few doubts regarding NSImage. Question1: Changing the bounds origin of an image doesn't seem to have any effect. I expected the image to be drawn from the newly set origin but that doesn't seem to the case. Am I…
user1046037
  • 16,755
  • 12
  • 92
  • 138
0
votes
1 answer

ascending buttons from 0 to 99

I need my buttons to start on 0 on the bottom left corner and go to 99 all the way to the right top corner.. Can you please help me correct my code. Every chage I make to fix it, takes all the buttons lower and I dont need that private void…
0
votes
1 answer

can't relocate a JButton object in a window

I've been trying to resize the button or to use the setLocation and setBounds methods. It doesn't matter whatever I put in the args the button just never changes. I need to learn to relocate whether a button, a label, a textfield, any component in…
0
votes
1 answer

How to place a button over JFrame title bar

I want to place a button on the JFrame title bar as in the below image. When I set the bounds for the button using button.setBounds(), the button hides under the title bar as below. I have given below the code that I had tried. public class…
Kather
  • 95
  • 8
0
votes
0 answers

JTextField not appearing at setBounds coordinates

I've got a problem where I'm adding a JTextField to a JPanel and it appears centered horizontally and adjacent to the top border instead of at the coordinates I set with setBounds(). My code has a class that creates a JFrame and calls a new Jpanel…
Guido
  • 1
  • 1
0
votes
1 answer

Moving labels in nested panels

I've made two grids and added them to a window using nested panels. The only issue is that I can't move the grid in the center and can't get the labels under their respective grids. Tried using setBounds but that's not working. Any advice? I've…
0
votes
1 answer

Can’t setBounds even with NS_BUILD_32_LIKE_64 macro

My project compiles and runs OK in debug mode, but when I switch to release x86_64 compiling, I get compiler errors for attempts to setBounds using NSRect. (The errors read “incompatible type for argument 1 of setBounds”.) There are lots of posts…
Wienke
  • 3,723
  • 27
  • 40
0
votes
0 answers

JLabel setLocation and setBounds methods not working

First of all, I am well aware of the existence of Layout Managers, I just don't want to use it in this case. I'm writing a simple main menu for my application, but no matter what I do the Image (JLabel) always sets itself in left upper corner of…