alignment

How can I align all elements to the left in JPanel?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-29 04:27:46
问题 I would like to have all elements in my JPanel to be aligned to the left. I try to do it in the following way: JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setAlignmentX(Component.LEFT_ALIGNMENT); As a result Java use left side of all elements as a position of the element and then put all elements in the center (not left part) of the JPanel. 回答1: The easiest way I've found to place objects on the left is using FlowLayout. JPanel panel = new

bootstrap 4 cards - vertical alignment body with variable header line rows

南楼画角 提交于 2019-12-29 01:26:10
问题 In my simple design I use cards to show some products. However some product titles wrap 2 lines while others wrap only 1 line. I would like to have the body text vertically aligned (and the price buttons too).. <div class="container"> <div class="row"> <div class="col-12"> <div class="card-group"> <div class="card text-center" > <img class="card-img-top mx-auto d-block" style="max-width: 100%; max-height: 100%;object-fit: scale-down" src="http://s.s-bol.com/imgbase0/imagebase3/thumb/FC/1/4/7

align AlertDialog buttons to center

有些话、适合烂在心里 提交于 2019-12-28 16:31:08
问题 I use this codes for Android (Java) programming: public static MessageBoxResult showOk( Context context, String title, String message, String okMessage) { okDialogResult = MessageBoxResult.Closed; // make a handler that throws a runtime exception when a message is received final Handler handler = new Handler() { @Override public void handleMessage(Message mesg) { throw new RuntimeException(); } }; AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(title); alert

center table in HTML

江枫思渺然 提交于 2019-12-28 04:04:11
问题 How can I center the table within a div using html? I have placed my content within a div tag and set the text-align attribute to center like the following. text-align: center; This has not worked. Below is my html. <html> <body> <div style="text-align:center"> <p> text test </p> <table border="1"> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> </div> </body> </html> 回答1: Give width to table, and set margin auto horizontally. table

Center form submit buttons HTML / CSS

为君一笑 提交于 2019-12-28 01:52:28
问题 I'm having troubles centering my HTML form submit buttons in CSS. Right now I'm using: <input value="Search" title="Search" type="submit" id="btn_s"> <input value="I'm Feeling Lucky" title="I'm Feeling Lucky" name="lucky" type="submit" id="btn_i"> with this CSS content #btn_s{ width: 100px; margin-left: auto; margin-right: auto; } #btn_i { width: 125px; margin-left: auto; margin-right: auto; } And it's not doing anything. I know I'm probably doing something stupid wrong. How can I fix this?

How to align footer (div) to the bottom of the page? [duplicate]

ぐ巨炮叔叔 提交于 2019-12-28 01:48:07
问题 This question already has answers here : How do you get the footer to stay at the bottom of a Web page? (27 answers) Closed 5 years ago . Can anyone explain how to align a footer div to the bottom of the page. From the examples I've seen, they all show how to make the div stay visible at the bottom, no matter where you've scrolled the page. Although I don't want it like that. I want it fixed at the bottom of the page, so it doesn't move. Appreciate the help! 回答1: UPDATE My original answer is

Should I worry about the alignment during pointer casting?

倖福魔咒の 提交于 2019-12-27 17:11:44
问题 In my project we have a piece of code like this: // raw data consists of 4 ints unsigned char data[16]; int i1, i2, i3, i4; i1 = *((int*)data); i2 = *((int*)(data + 4)); i3 = *((int*)(data + 8)); i4 = *((int*)(data + 12)); I talked to my tech lead that this code may not be portable since it's trying to cast a unsigned char* to a int* which usually has a more strict alignment requirement. But tech lead says that's all right, most compilers remains the same pointer value after casting, and I

How to align input forms in HTML

烈酒焚心 提交于 2019-12-27 16:24:10
问题 I'm new to HTML and I'm trying to learn how to use forms. The biggest issue I am having so far is aligning the forms. Here is an example of my current HTML file: <form> First Name:<input type="text" name="first"><br /> Last Name:<input type="text" name="last"><br /> Email:<input type="text" name="email"><br /> </form> The problem with this is, the field box after 'Email' is drastically different in terms of spacing compared to first, and last name. What is the 'proper' way to make it so that

Align ImageView & TextView inside LinearLayout

╄→尐↘猪︶ㄣ 提交于 2019-12-26 16:56:12
问题 I have a LinearLayout and inside, a ImageView and TextView. I want to align the center of the LinearLayout the ImageView and the TextView below the ImageView. I only get the top align ImageView in LinearLayout. How I can do? <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_weight="1" android:layout_margin="8dp" android:gravity="center_horizontal" android:orientation="vertical" > <ImageView android

CSS: Align an element based on screen size

柔情痞子 提交于 2019-12-25 18:14:12
问题 So I'm writing a program that will need to resize elements based on the viewers screen size. The program is in jsp / sql/ xhtml / css and I have a few questions. Is there any way to select a css file by saving the screen width to a jsp variable? Is there a way to align a div below another div and use the above div as a sort of container for it? This question is a little complicated Goal: To have an image with a text label underneath it. Problem: The div is part of a parent div, and the div