Skip to content
Advertisement

Tag: layout

Horizontal JScrollPane inside vertical JScrollPane

Good afternoon! It is necessary to make a list (vertical) from lists of events (horizontal). There are at least 2 problems: the area of the list of events (horizontal scrolling) expands beyond the borders of the panel. Apparently, the problem is with Layout, but I can not find the right combination; horizontal scrolling does not work (probably due to the

How to set the width and height of a layout in Android?

I have this ConstraintLayout: lateinit var myConstraintLayout: ConstraintLayout I try to set its width and height to match its parent via code, like this: But I get error androidx.constraintlayout.widget.ConstraintLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams Why? How do I fix this? Answer The LayoutParams need to be the LayoutParams type of the parent ViewGroup. It is the parent ViewGroup that actually

How to set order for dynamically added JavaFX components?

I have a button that generates another button each time it’s clicked. 1 of the problems is, that the generated button is placed in the wrong location. The buttons should start around the Top Left side of the window, but the location of the buttons is at the bottom left of the window. I can’t use the function setAlignment(Pos.TOP_LEFT) to

How do I write a JUnit test for a custom SWT-Column-Ratio-Layout?

I found a custom SWT-Column-Ratio Layout on the internet which puts the children of a composite/control into a user-defined ratio. Unfortunately I cannot find the source of the implementation of the Column-Ratio Layout, but here’s how the code looks like: I want to test this layout. I am writing a JUnit test to test if the ratio is true when

Scaling an ImageView when the soft keyboard opens

I’m creating a tabbed activity. As long as the first tab is selected, the soft keyboard should be visible. I achieved that by adding this line to my manifest file in the activity tag: As the keyboard opens, the space for the layout shrinks. The most space is occupated by an ImageView. I want it to shrink with the layout

Square GridPane of square cells

My goal is to create a GridView that is resizable, always square and contains an equal number of rows and columns, making their cells also square, similar to a Reversi or Chess board. Here’s a small illustration, the grid is centered horizontally on the content pane. I’ve tried a multitude of different binding variants and layouts, but I can’t quite

How to lock aspect ratio of a gridLayout in Java?

Is there an easy way of locking the aspect ratio of a GridLayout component in Java Swing ? Or should this be done on the JPanel containing that layout ? Answer GridLayout effectively ignores a component’s preferred size, but you can control the aspect ratio of whatever is drawn in paintComponent(), as shown in this example. The rendered shape remains

Advertisement