我正在使用bootstrap 3,内联表单请全屏查看,您会注意到选择菜单略高于内联表单。在我的项目中,我正在使用ChosenJS。这个片段没有,但仍然略高于其他输入字段。
如果我用另一个输入切换选择,一切正常。它与select元素本身有关。
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.WindowConstants;
public class SwingAnimationExample extends JPanel implements ActionListener {
private static final int MAX_STATE = 4;
private int state;
public SwingAnimationExample() {
// start timer to provide state change and repaint
Timer t = new Timer(250, this);
t.start();
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
// painting depended on the current state
if (state == 0) {
g.drawLine(0, 0, getWidth(), getHeight());
} else if (state == 1) {
g.drawLine(getWidth() / 2, 0, getWidth() / 2, getHeight());
} else if (state == 2) {
g.drawLine(getWidth(), 0, 0, getHeight());
} else if (state == 3) {
g.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2);
}
}
@Override
public void actionPerformed(ActionEvent e) {
// change the current state and invoke repaint
state++;
if (state == MAX_STATE) {
state = 0;
}
repaint();
}
public static void main(String[] args) {
JFrame frm = new JFrame("Test timer");
frm.add(new SwingAnimationExample());
frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frm.setSize(500, 400);
frm.setLocationRelativeTo(null);
frm.setVisible(true);
}
}
答案 0 :(得分:2)
将form-control
课程应用于您的选择元素
然后您也可以尝试在<div class="form-horizontal"></div>
中包装元素,也可以将它们放在container class
中,并通过使用<div class="row"></div>
以上一直对我有用。
另请查看此fiddle。使用您的代码,一切都很顺利