本文整理汇总了Java中com.jgoodies.forms.factories.DefaultComponentFactory.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultComponentFactory.getInstance方法的具体用法?Java DefaultComponentFactory.getInstance怎么用?Java DefaultComponentFactory.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jgoodies.forms.factories.DefaultComponentFactory
的用法示例。
在下文中一共展示了DefaultComponentFactory.getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponentFactory
import com.jgoodies.forms.factories.DefaultComponentFactory; //导入方法依赖的package包/类
public final ComponentFactory getComponentFactory()
{
if (this.componentFactory == null) {
this.componentFactory = DefaultComponentFactory.getInstance();
}
return this.componentFactory;
}
示例2: createPanel
import com.jgoodies.forms.factories.DefaultComponentFactory; //导入方法依赖的package包/类
public JPanel createPanel() {
JPanel jpanel1 = new JPanel();
EmptyBorder emptyborder1 = new EmptyBorder(5, 5, 5, 5);
jpanel1.setBorder(emptyborder1);
FormLayout formlayout1 = new FormLayout(
"FILL:25PX:NONE,FILL:DEFAULT:GROW(1.0)",
"CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:20PX:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,FILL:PREF:GROW,CENTER:20PX:NONE,CENTER:DEFAULT:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
DefaultComponentFactory fac = DefaultComponentFactory.getInstance();
titleStep1 = fac.createSeparator("Step 1");
titleStep1.setName("titleStep1");
jpanel1.add(titleStep1, cc.xywh(1, 1, 2, 1));
titleStep2 = fac.createSeparator("Step 2");
titleStep2.setName("titleStep2");
jpanel1.add(titleStep2, cc.xywh(1, 5, 2, 1));
txtName.setName("txtName");
jpanel1.add(txtName, cc.xy(2, 3));
JScrollPane paneDesc = new JScrollPane(txtDescription);
jpanel1.add(paneDesc, cc.xy(2, 7));
JLabel jlabel1 = new JLabel();
jlabel1.setText("Enter a name for the new corpus:");
jpanel1.add(jlabel1, cc.xy(2, 2));
JLabel jlabel2 = new JLabel();
jlabel2.setText("Enter a description for the new corpus:");
jpanel1.add(jlabel2, cc.xy(2, 6));
btnCreateCorpus.setActionCommand("Create");
btnCreateCorpus.setName("btnCreateCorpus");
btnCreateCorpus.setText("Ok");
btnCreateCorpus.addActionListener(e -> {
if(validateForm()) {
wasCanceled = false;
NewCorpusDialog.this.setVisible(false);
NewCorpusDialog.this.dispose();
}
});
btnCreateCorpus.setDefaultCapable(true);
getRootPane().setDefaultButton(btnCreateCorpus);
btnCancel.setActionCommand("Cancel");
btnCancel.setName("btnCancel");
btnCancel.setText("Cancel");
btnCancel.addActionListener(e -> {
wasCanceled = true;
NewCorpusDialog.this.setVisible(false);
NewCorpusDialog.this.dispose();
});
JComponent buttonBar = ButtonBarBuilder.buildOkCancelBar(btnCreateCorpus, btnCancel);
jpanel1.add(buttonBar, cc.xyw(1, 9, 2));
addFillComponents(jpanel1, new int[] { 2 }, new int[] { 2,3,4,6,7,8 });
return jpanel1;
}
示例3: createPanel
import com.jgoodies.forms.factories.DefaultComponentFactory; //导入方法依赖的package包/类
public JPanel createPanel() {
JPanel jpanel1 = new JPanel();
EmptyBorder emptyborder1 = new EmptyBorder(5,5,5,5);
jpanel1.setBorder(emptyborder1);
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:20PX:NONE,CENTER:DEFAULT:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
DefaultComponentFactory fac = DefaultComponentFactory.getInstance();
JComponent titledseparator1 = fac.createSeparator("Step 1");
jpanel1.add(titledseparator1,cc.xywh(1,1,2,1));
JComponent titledseparator2 = fac.createSeparator("Step 2");
jpanel1.add(titledseparator2,cc.xywh(1,5,2,1));
JLabel jlabel1 = new JLabel();
jlabel1.setText("Select the corpus you wish to rename:");
jpanel1.add(jlabel1,cc.xy(2,2));
JLabel jlabel3 = new JLabel();
jlabel3.setText("Enter the new name for the corpus:");
jpanel1.add(jlabel3,cc.xy(2,6));
// Add existing corpora to combo box
final List<String> corpora = project.getCorpora();
for(String corpusName : corpora)
cmbCorpus.addItem(corpusName);
cmbCorpus.setName("cmbCorpus");
jpanel1.add(cmbCorpus,cc.xy(2,3));
txtName.setName("txtName");
jpanel1.add(txtName,cc.xy(2,7));
btnRenameCorpus.setActionCommand("Rename");
btnRenameCorpus.setName("btnRenameCorpus");
btnRenameCorpus.setText("Ok");
btnRenameCorpus.addActionListener( e -> {
if(!validateForm()) {
ToastFactory.makeToast("Invalid characters in name").start(txtName);
return;
}
wasCanceled = false;
setVisible(false);
dispose();
});
getRootPane().setDefaultButton(btnRenameCorpus);
btnCancel.setActionCommand("Cancel");
btnCancel.setName("btnCancel");
btnCancel.setText("Cancel");
btnCancel.addActionListener(e -> {
wasCanceled = true;
setVisible(false);
dispose();
});
JComponent buttonBar = ButtonBarBuilder.buildOkCancelBar(btnRenameCorpus, btnCancel);
jpanel1.add(buttonBar, cc.xyw(1, 9, 2));
addFillComponents(jpanel1,new int[]{ 2 },new int[]{ 2,3,4,6,7,8 });
return jpanel1;
}
示例4: createPanel
import com.jgoodies.forms.factories.DefaultComponentFactory; //导入方法依赖的package包/类
public JPanel createPanel() {
JPanel jpanel1 = new JPanel();
FormLayout formlayout1 = new FormLayout(
"CENTER:25PX:NONE,FILL:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE",
"CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:20PX:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:20PX:NONE,CENTER:DEFAULT:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
jpanel1.setBorder(new EmptyBorder(5, 5, 5, 5));
DefaultComponentFactory fac = DefaultComponentFactory.getInstance();
JComponent titledseparator1 = fac.createSeparator("Step 1");
jpanel1.add(titledseparator1, cc.xywh(1, 1, 3, 1));
JComponent titledseparator2 = fac.createSeparator("Step 2");
jpanel1.add(titledseparator2, cc.xywh(1, 5, 3, 1));
JLabel jlabel1 = new JLabel();
jlabel1.setText("Enter a name for the new session:");
jpanel1.add(jlabel1, cc.xywh(2, 2, 2, 1));
txtName.setName("txtName");
jpanel1.add(txtName, cc.xywh(2, 3, 2, 1));
cmbCorpus.setName("cmbCorpus");
jpanel1.add(cmbCorpus, cc.xy(2, 7));
// ImageFactory imgFactory = ImageFactory.getInstance();
// ImageIcon im = new ImageIcon(imgFactory.getImage("new_corpus", 16, 16));
ImageIcon im = IconManager.getInstance().getIcon(
"actions/list-add", IconSize.SMALL);
btnCreateCorpus.setIcon(im);
btnCreateCorpus.setName("btnCreateCorpus");
btnCreateCorpus.addActionListener(new CreateCorpusListener());
jpanel1.add(btnCreateCorpus, cc.xy(3, 7));
JLabel jlabel2 = new JLabel();
jlabel2.setText("Select a corpus to use for this session:");
jpanel1.add(jlabel2, cc.xy(2, 6));
addFillComponents(jpanel1, new int[] { 2,3 }, new int[] { 2,3,4,6,7,8 });
return jpanel1;
}
示例5: addROLabel
import com.jgoodies.forms.factories.DefaultComponentFactory; //导入方法依赖的package包/类
/**
* Adds a textual label intended for labeling read-only components
* to the form using the specified constraints.<p>
*
* <pre>
* addROLabel("Name:", cc.xy(1, 1)); // No Mnemonic
* addROLabel("N&ame:", cc.xy(1, 1)); // Mnemonic is 'a'
* addROLabel("Save &as:", cc.xy(1, 1)); // Mnemonic is the second 'a'
* addROLabel("Look&&Feel:", cc.xy(1, 1)); // No mnemonic, text is "look&feel"
* </pre>
*
* @param textWithMnemonic the label's text -
* may contain an ampersand (<tt>&</tt>) to mark a mnemonic
* @param constraints the label's cell constraints
* @return the new label
*
* @see ComponentFactory2
*
* @since 1.3
*/
public final JLabel addROLabel(String textWithMnemonic, CellConstraints constraints) {
ComponentFactory factory = getComponentFactory();
ComponentFactory2 factory2;
if (factory instanceof ComponentFactory2) {
factory2 = (ComponentFactory2) factory;
} else {
factory2 = DefaultComponentFactory.getInstance();
}
JLabel label = factory2.createReadOnlyLabel(textWithMnemonic);
add(label, constraints);
return label;
}
示例6: getComponentFactory
import com.jgoodies.forms.factories.DefaultComponentFactory; //导入方法依赖的package包/类
/**
* Returns the builder's component factory. If no factory
* has been set before, it is lazily initialized using with an instance of
* {@link com.jgoodies.forms.factories.DefaultComponentFactory}.
*
* @return the component factory
*
* @see #setComponentFactory(ComponentFactory)
*/
public final ComponentFactory getComponentFactory() {
if (componentFactory == null) {
componentFactory = DefaultComponentFactory.getInstance();
}
return componentFactory;
}