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
0
votes
1 answer

Jpanel placed on the same location at one other panel

public class DataGUI { private static int option; public static void main(String args[]) { JFrame frame = new JFrame(); frame.setSize(900, 700); JPanel weatherPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); …
KhoaVo
  • 376
  • 3
  • 18
0
votes
1 answer

How to place JButtons at a certain coordinate in a JFrame

I want to know how to place JButtons at a particular coordinate in the JFrame. All day I have seen layouts. This does not suit my purpose. I would prefer something like setBounds. Rumour has it that it does not work but setLocation does. I tried it…
Haxed
  • 2,887
  • 14
  • 47
  • 73
0
votes
1 answer

How do I use JList inside of JPanel So I can set the bounds of the list?

I am having trouble using JLists in Java. I have watched video tutorials on how to use them, but they all use them with some sort of layout. I would like to have it so the "setPreferedLayout" is null, and I can use the setBounds method to decide…
Andrew900460
  • 621
  • 1
  • 6
  • 16
0
votes
1 answer

Is using more JPanels and the use of the setBounds() method okay?

I have written many simple GUIs, they worked fine. However as a beginner I always think that my way of writing user interfaces is not very good practice. Is it proper practice if one uses more panels to get the desired interface? Also is the use of…
Ahmad
  • 21
  • 8
0
votes
1 answer

Set Controls with arbitrary positions on CTabItem

I am new to SWT, and I need to set the controls positions arbitrary on CTabItem. I've used the following code, but it seems that it had no positioning effect, it just add the component to (0, 0) Label userName = new Label(folder,…
Muhammad Hewedy
  • 29,102
  • 44
  • 127
  • 219
0
votes
0 answers

Unable to add element to the Flow Layout in function

I have to create a small form page containing several label and text fields beside that and button to take action on that. At the top one label has been set which displays some common information. There is one function which set the bounds for all…
Learner
  • 1,544
  • 8
  • 29
  • 55
0
votes
2 answers

Why are bounds not being set for rectangles and returning to the same int?

Im trying to set the x and y of these rectangles but any time i try they keep setting at 99. No matter where i set it it keeps going to that. As far as i know the only thing i can think of is that the Block classes x and y made inside the classare…
0
votes
1 answer

java gui setbounds doesnt work

i am trying to make an UI in java and i am new in this so sorry if it's an easy question. public class viewDeneme extends JFrame { private static final long serialVersionUID = -7284396337557548747L; private JTextField nameTxt = new…
Koray Durudogan
  • 624
  • 4
  • 12
  • 31
0
votes
1 answer

How to set bounds for 3d map in vtk by c++?

I have a lot of lines and planes which are around, for example, (0.5, 0.5, 0.5) point. Also I have area where they have importance, it's a cube. And lines, planes have possibility to intersect this area, and be outside of it. Can I hide part of all…
0
votes
2 answers

How to put texts one on top of the other using JLabels?

I'm trying to make a list of texts that looks like this: I have this code: panelPunts = new JPanel(); panelPunts.setBackground(Color.GRAY); biggerPanel.add(panelPunts, BorderLayout.EAST); JLabel titol = new JLabel(); titol.setText("

p. bosch
  • 139
  • 2
  • 10
0
votes
2 answers

How to scale imageview image to specific size?

I created an imageview image, but I want to scale it to be no greater than a fifth of the width and a sixth of the height of the android device's screen size. Here I get the width and height of the screen: DisplayMetrics metrics = new…
user3488148
  • 59
  • 1
  • 8
0
votes
1 answer

.NET: Move control according to rectangle

I would like to place a control at the location and with the size of a rectangle. I tried it like this: Me.RichTextBox1.SetBounds(myRectangle) However, there is no overloaded SetBounds that accept a rectangle. That really confuses me.
tmighty
  • 10,734
  • 21
  • 104
  • 218
0
votes
3 answers

How can I improve my knowledge in positioning components in java?

is setBound() the best way for setting the position of GUI? What are the other option and each own strength over the other? tnx
gihooh
  • 303
  • 1
  • 6
  • 16
0
votes
1 answer

buttonname.setBounds(xlocation,ylocation, width, height); doesn't work for me?

package com.tests; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; public class LevelUp { public static void main(String[] args) { // TODO Auto-generated method stub final int width = 1000; …
ShuLei
  • 11
  • 3
0
votes
1 answer

Setting my component in specified place

What I want to do is a put my component close to the right side of my application. Second option is to put it in specified x,y coordinates. However I tried setBounds() setLocation() and add(component, BorderLayout.LINE_END) funcions. Nothing works…
user2410128