grid-layout

Java Swing Gridlayout: Accessing Specific Coordinate

余生颓废 提交于 2019-12-10 23:23:23
问题 I'm creating a Java swing GUI and I have formatted a JPanel to use a GridLayout. I need to access a specific "box" (i.e. specific coordinate) of the grid, but I cannot see a way to do so. How can I do this? 回答1: You shouldn't depend on GUI code (the View) to give you information about program data (the model). The best solution would be to "know" which component is where from the start--maybe you should have a data structure (2D array?) that holds the components and is updated whenever

Can't achieve grid layout with CSS grid [duplicate]

随声附和 提交于 2019-12-10 18:02:46
问题 This question already has answers here : Make a div span two rows in a grid (2 answers) Closed 9 months ago . In trying to learn more about CSS grid, I am trying to create some different grid layouts. The one I am trying to create is the following: Here is one step of this: .wrapper { display: grid; grid-gap: 15px; grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: repeat(8, 1fr); } .wrapper .first_box { grid-column-start: 2; grid-column-end: 4; grid-row-start: 1; grid-row-end: 7; }

Adding buttons using gridlayout

孤者浪人 提交于 2019-12-10 17:06:40
问题 I'm trying to create a simple tic tac toe board made by 9x9 JButtons. I used a 2d array and a gridlayout but the result is nothing, a frame without any button. What I'm doing wrong? import java.awt.GridLayout; import javax.swing.*; public class Main extends JFrame { private JPanel panel; private JButton[][]buttons; private final int SIZE = 9; private GridLayout experimentLayout; public Main() { super("Tic Tac Toe"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500,500);

Node cannot be inserted at the specified point in the hierarchy“ code: ”3

南楼画角 提交于 2019-12-10 14:56:30
问题 Hey, it's me again with a question about jquery and that gridlayout I made a php template with switch and the code i am inserting is this <div id="wrapper"> <div id="grid"> <div class="box"><img src="img/an_005_BUR_thebeat.jpg" width="310px" height="438px" />3 index</div> <div class="box"><img src="img/an_014_GUE_homme_a.jpg" width="310px" height="404px" />4 Culture</div> <div class="box"><img src="img/an_044_BVL_springmotiv.jpg" width="310px" height="310px" />5 Pharma</div> <div class="box">

Vaadin - Expand components in Grid Layout in Vaadin

≯℡__Kan透↙ 提交于 2019-12-10 12:44:15
问题 I am doing my project in Vaadin 6. In that, I have integrated the components in a Grid layout. I have attached a image with this. It resembles my Project layout. It is similar to eclipse. So, The layout will have two side panels on left and right. and a center and bottom panel. And the red color in the image are buttons. When I press them the panel will be minimized. I want the center panel to expand and occupy the minimized panel's area. I have integrated the panels in grid layout. Can

Shrink grid items just like flex items in css

谁说我不能喝 提交于 2019-12-10 09:43:21
问题 Is it possible to shrink grid items just like flex items in css? Grid items .container { display: grid; grid-gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } .child { display: flex; flex-flow: row wrap; align-items: center; justify-content: center; padding: 5px; border: 3px solid #a07; } <div class="container"> <div class="child"> text </div> <div class="child"> text </div> <div class="child"> text </div> <div class="child"> text </div> <div class="child"> text </div

Auto-growing margins when screen width get stretched

*爱你&永不变心* 提交于 2019-12-10 02:25:24
问题 I have a list ( <ul /> ) that I try to display as a grid. The cells have a fixed width (let's say 100px): the number of cols and rows depends then on the screen resolution. When the screen has a large width, there are many columns but few lines: ______________________________________________________________ | ___________ ___________ ___________ ___________ | | | | | | | | | | | | | #1 | | #2 | | #3 | | #4 | | | |<- 100px ->| |<- 100px ->| |<- 100px ->| |<- 100px ->| | | | | | | | | | | | | |_

Android Custom GridLayout with Text+Image

你说的曾经没有我的故事 提交于 2019-12-09 07:11:42
问题 In my application, I am trying to get the details of a set of users from a web-service. Then, I want to display the Image of each user along with their names in a GridLayout. I haven't used GridLayout before and hence tried to go through the tutorials available online, but most of them deal with just the Images. I need to display both the Image and the Text in the Grid. How do I setup the custom GridLayout to display the Text along with the Images ? 回答1: Try this : public class GridActivity

Horizontally center Views inside Android GridLayout

余生长醉 提交于 2019-12-08 18:54:05
问题 We are writing an app targeting ICS+ and believe a GridLayout is the best layout paradigm, but it seems very little has been written about it, and we are having some alignment issues. <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/row_background" android:rowCount="1" android:columnCount="3" android:layout_width="match_parent" android:layout_height="match_parent" android:useDefaultMargins="true" android:background="@drawable/list_item_bg"> <ImageView

How to horizontally center a widget using grid()?

冷暖自知 提交于 2019-12-08 16:53:31
问题 I am using grid() to place widgets in a tkinter window. I am trying to put a label on the horizontal center of a window and have it stay there, even if the window is resized. How could I go about doing this? I don't want to use pack() , by the way. I would like to keep using grid() . 回答1: There's no trick -- the widget is centered in the area allocated to it by default. Simply place a label in a cell without any sticky attributes and it will be centered. Now, the other question is, how to get