📄 util.java
字号:
package org.dbgen.view;import java.awt.*;import java.util.*;import javax.swing.*;import org.dbgen.*;/** * This class was generated by a SmartGuide. * */public class Util { /** * This method was created by a SmartGuide. * @param container java.awt.Container * @param row int * @param col int * @param weightx float * @param weighty float * @param fill int * @param anchor int * @param insets java.awt.Insets */ public static void addgbc(Container container, Component component, GridBagConstraints gbc, int row, int col, float weightx, float weighty, int fill, int anchor, Insets insets) { gbc.gridx = col; gbc.gridy = row; gbc.weightx = weightx; gbc.weighty = weighty; gbc.fill = fill; gbc.anchor = anchor; gbc.insets = insets; container.add(component, gbc); return; } /** * This method was created by a SmartGuide. * @param container java.awt.Container * @param row int * @param col int * @param weightx float * @param weighty float * @param fill int * @param anchor int * @param insets java.awt.Insets */ public static void addgbc2(Container container, Component component, GridBagConstraints gbc, int row, int col, int gridwidth, int gridheight, float weightx, float weighty, int fill, int anchor, Insets insets) { gbc.gridx = col; gbc.gridy = row; gbc.weightx = weightx; gbc.weighty = weighty; gbc.gridwidth = gridwidth; gbc.gridheight = gridheight; gbc.fill = fill; gbc.anchor = anchor; gbc.insets = insets; container.add(component, gbc); return; } /** * This method was created by a SmartGuide. * @param panel JPanel * @param c GridBagConstraints * @param row int * @param comp JComponent */ public static void addGridBagComponent(JPanel panel, GridBagConstraints c, int row, JComponent comp) { Insets insets = new Insets(2, 2, 2, 2); if (row > 1 && row % 2 == 1) { insets = new Insets(10, 2, 2, 2); } if (comp instanceof JButton || comp instanceof JComboBox) { c.fill = GridBagConstraints.VERTICAL; } else { c.fill = GridBagConstraints.BOTH; } c.gridx = 1; c.gridy = row; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; c.insets = insets; panel.add(comp, c); return; } /** * This method was created by a SmartGuide. */ public static JComboBox createFieldTypesComboBox() { JComboBox box = new JComboBox(); Vector map = FieldTypes.getMap(); for (int i = 0; i < map.size(); i++) { org.dbgen.Map pair = (org.dbgen.Map) map.elementAt(i); box.addItem(new FieldType(pair.key)); } return box; } /** * This method was created by a SmartGuide. * @return int * @param obj java.lang.Object * @param list java.util.Vector */ public static int findObjectFromVector(Object obj, Vector list) { int i; for (i = 0; i < list.size(); i++) { if (obj == list.elementAt(i)) return i; } return i; } /** * This method was created by a SmartGuide. * @param buf java.lang.StringBuffer */ public static void showErrorBuffer(Component parent, StringBuffer buf, String title) { JTextArea msgPane = new JTextArea(); //, 8, 80); JScrollPane scroller = new JScrollPane() { public Dimension getPreferredSize() { return new Dimension(300,400); } public float getAlignmentX() { return LEFT_ALIGNMENT; } }; scroller.getViewport().add(msgPane); msgPane.setText(buf.toString()); msgPane.setSize(300,400); JOptionPane.showMessageDialog(parent, scroller, title, JOptionPane.ERROR_MESSAGE); return; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -