本文整理匯總了Java中net.miginfocom.swing.MigLayout類的典型用法代碼示例。如果您正苦於以下問題:Java MigLayout類的具體用法?Java MigLayout怎麽用?Java MigLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MigLayout類屬於net.miginfocom.swing包,在下文中一共展示了MigLayout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initialize
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
/**
* Initialize the contents of the frame.
*/
public void initialize(){
JPanel panel_7 = new JPanel();
panel_7.setBounds(0, 0, 665, 415);
frmPiattaformaGaming.getContentPane().add(panel_7);
panel_7.setLayout(new MigLayout());
panel_7.setVisible(true);
JTextArea ta = new JTextArea();
ta.setEditable(false);
panel_7.add(ta);
ArrayList<Recensione> al = new GiocoController(gioco).allReviews();
for( Recensione r : al ){
ta.setText(ta.getText() + " - " + r.getTesto() + "\n\n");
}
JButton btnBack = new JButton("Indietro");
panel_7.add(btnBack, "pos 267px 345px, width 110, height 15");
JScrollPane scroll = new JScrollPane(ta);
scroll.setVerticalScrollBarPolicy ( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scroll.getVerticalScrollBar().setUnitIncrement(20);
scroll.setSize(460,240);
panel_7.add(scroll, "pos 0px 0px, width 660, height 340");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
panel_7.setVisible(false);
new GiocoView(frmPiattaformaGaming, utente, gioco);
}});
}
示例2: actionPerformed
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
public void actionPerformed(ActionEvent e) {
// FIXME: don't create a new one each time!
final File logfile = new File(Info.getHomeDir(), "errorLog");
final LogPane lp = new LogPane(logfile);
// FIXME: this should have its own key. Probably keys should be renamed
// to reflect what they are labeling, e.g., Help.show_error_log_menu_item,
// Help.error_log_dialog_title.
final JDialog d =
new JDialog(frame, Resources.getString("Help.error_log"));
d.setLayout(new MigLayout("insets 0"));
d.add(new JScrollPane(lp), "grow, push, w 500, h 600");
d.setLocationRelativeTo(frame);
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.pack();
d.setVisible(true);
}
示例3: StanceTradeItemPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
/**
* Creates a new {@code StanceTradeItemPanel} instance.
*
* @param source The {@code Player} offering the stance change.
* @param target The {@code Player} to consider the stance change.
*/
public StanceTradeItemPanel(Player source, Player target) {
this.source = source;
this.target = target;
this.stanceBox = new JComboBox<>(new DefaultComboBoxModel<Stance>());
this.stanceBox.setRenderer(new StanceBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
this.clearButton.setActionCommand(CLEAR);
this.addButton = Utility.localizedButton("negotiationDialog.add");
this.addButton.addActionListener(this);
this.addButton.setActionCommand(ADD);
setBorder(Utility.SIMPLE_LINE_BORDER);
setLayout(new MigLayout("wrap 1", "", ""));
add(Utility.localizedLabel(Messages.nameKey("model.tradeItem.stance")));
add(this.stanceBox);
add(this.clearButton, "split 2");
add(this.addButton);
}
示例4: EventPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
/**
* The constructor that will add the items to this panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param header The title.
* @param key A resource key for the image to display.
* @param footer Optional footer text.
*/
public EventPanel(FreeColClient freeColClient, String header, String key,
String footer) {
super(freeColClient, new MigLayout("wrap 1", "[center]", "[]20"));
JLabel headerLabel = new JLabel(header);
headerLabel.setFont(FontLibrary.createCompatibleFont(header,
FontLibrary.FontType.HEADER, FontLibrary.FontSize.MEDIUM));
JLabel imageLabel
= new JLabel(new ImageIcon(ResourceManager.getImage(key)));
JLabel footerLabel = (footer == null) ? null : new JLabel(footer);
add(headerLabel);
add(imageLabel);
if (footerLabel != null) add(footerLabel);
add(okButton, "tag ok");
setSize(getPreferredSize());
}
示例5: buildOldVersionPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
private Component buildOldVersionPanel() {
final FlowLabel label = new FlowLabel(
Resources.getString("BugDialog.old_version_instructions"));
label.addHyperlinkListener(BrowserSupport.getListener());
final JScrollPane detailsScroll = buildDetailsScroll();
final DetailsButton detailsButton = new DetailsButton(
Resources.getString("Dialogs.show_details"),
Resources.getString("Dialogs.hide_details"),
detailsScroll
);
detailsButton.setBuddy(label);
final JPanel panel = new JPanel(new MigLayout(
"hidemode 3", "", "[]unrel[]rel[]"));
panel.add(label, "cell 0 0, growx, pushx");
panel.add(detailsButton, "cell 0 1");
panel.add(detailsScroll, "cell 0 2, grow, push");
return panel;
}
示例6: buildOldVersionButtons
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
private Component buildOldVersionButtons() {
final JButton okButton = new JButton(
new AbstractAction(Resources.getString(Resources.OK)) {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
showEmergencySavePanel();
}
}
);
final JPanel panel = new JPanel(new MigLayout("align right"));
panel.add(okButton, "tag ok");
return panel;
}
示例7: ReportIndianPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
/**
* The constructor that will add the items to this panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
*/
public ReportIndianPanel(FreeColClient freeColClient) {
super(freeColClient, "reportIndianAction");
Player player = getMyPlayer();
reportPanel.setLayout(new MigLayout("wrap 6, fillx, insets 0",
"[]20px[center]", "[top]"));
boolean needsSeperator = false;
for (Player opponent : CollectionUtils.transform(getGame().getLiveNativePlayers(),
p -> player.hasContacted(p))) {
if (needsSeperator) {
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL),
"newline 20, span, growx, wrap 20");
}
buildIndianAdvisorPanel(player, opponent);
needsSeperator = true;
}
scrollPane.getViewport().setOpaque(false);
reportPanel.setOpaque(true);
reportPanel.doLayout();
}
示例8: MainView
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
public MainView() {
// Set layout
this.setLayout(new MigLayout("fillx","[][grow][]"));
// Define instruction label constraints
CC instructionLabelConstraint = new CC();
instructionLabelConstraint.alignX("center").spanX();
// Init instructions label
instructions = new JLabel("Select a boat, rotate it at will and place your it on the downer grid.");
// Add components to our MainView
this.add(instructions, instructionLabelConstraint);
this.add(letters,"w 100%-30, center, grow, wrap, h 8%");
this.add(gameView, "span 2 3 100%-30, center, grow, wrap, h 92%");
}
示例9: buildSendingBugReportButtons
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
private Component buildSendingBugReportButtons() {
final JButton cancelButton = new JButton(
new AbstractAction(Resources.getString(Resources.CANCEL)) {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
dispose();
}
}
);
final JPanel panel = new JPanel(new MigLayout("align right"));
panel.add(cancelButton, "tag cancel");
return panel;
}
示例10: MyPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
public MyPanel()
{
setLayout(new MigLayout("ins 5, gapx 12, gapy 1", "[][35!][100:500:10000]", ""));
setBorder(new UnderlineBorder(new Color(180, 180, 180)));
status = new JLabel();
status.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));
status.setOpaque(false);
add(status, "ay center, spany 2");
payment = new JLabel();
payment.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 12));
add(payment, "ax right, spany 2");
carinfo = new JLabel();
carinfo.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 12));
add(carinfo, "gap 0, wrap");
cardesc = new JLabel();
cardesc.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
add(cardesc, "gap 0");
}
示例11: OptionsPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
OptionsPanel() {
optionsPanel = new JPanel();
optionsPanel.setLayout(new MigLayout());
reportUnknownTranslations = new JCheckBox("Report unknown/untranslated messages", REPORT_UNKNOWN_TRANSLATIONS);
reportUnknownTranslations.addChangeListener(e -> REPORT_UNKNOWN_TRANSLATIONS = reportUnknownTranslations.isSelected());
optionsPanel.add(reportUnknownTranslations, "wrap");
reportNonAsciiCodes = new JCheckBox("Report non-ASCII characters usage", REPORT_NONASCII_CHARACTERS);
reportNonAsciiCodes.addChangeListener(e -> REPORT_NONASCII_CHARACTERS = reportNonAsciiCodes.isSelected());
optionsPanel.add(reportNonAsciiCodes, "wrap");
reportInjections = new JCheckBox("Suggest using parametrised messages", REPORT_INJECTIONS);
reportInjections.addChangeListener(e -> REPORT_INJECTIONS = reportInjections.isSelected());
optionsPanel.add(reportInjections, "wrap");
}
示例12: ReportPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
/**
* Creates the basic FreeCol report panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param key A key for the title.
*/
public ReportPanel(FreeColClient freeColClient, String key) {
super(freeColClient, new MigLayout("wrap 1", "[fill]",
"[]30[fill]30[]"));
header = Utility.localizedHeader(Messages.nameKey(key), false);
add(header, "cell 0 0, align center");
reportPanel = new MigPanel("ReportPanelUI");
reportPanel.setOpaque(true);
reportPanel.setBorder(createBorder());
scrollPane = new JScrollPane(reportPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setUnitIncrement( 16 );
add(scrollPane, SCROLL_PANE_SIZE);
add(okButton, "cell 0 2, tag ok");
float scale = getImageLibrary().getScaleFactor();
getGUI().restoreSavedSize(this, 200 + (int)(scale*850), 200 + (int)(scale*525));
}
示例13: GoodsTradeItemPanel
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
/**
* Creates a new {@code GoodsTradeItemPanel} instance.
*
* @param source The {@code Player} nominally in possession of the
* goods (this may be totally fictional).
* @param allGoods The {@code Goods} to trade.
*/
public GoodsTradeItemPanel(Player source, List<Goods> allGoods) {
this.source = source;
this.goodsBox = new JComboBox<>(new DefaultComboBoxModel<Goods>());
this.goodsBox.setRenderer(new GoodsBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
this.clearButton.setActionCommand(CLEAR);
this.addButton = Utility.localizedButton("negotiationDialog.add");
this.addButton.addActionListener(this);
this.addButton.setActionCommand(ADD);
this.label = Utility.localizedLabel(Messages.nameKey("model.tradeItem.goods"));
this.allGoods = allGoods;
setLayout(new MigLayout("wrap 1", "", ""));
setBorder(Utility.SIMPLE_LINE_BORDER);
add(this.label);
add(this.goodsBox);
add(this.clearButton, "split 2");
add(this.addButton);
setSize(getPreferredSize());
}
示例14: NewChallengeDialog
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
public NewChallengeDialog()
{
super(new MigLayout("", "[70, align right][100, fill]"), true);
ok.setText("Create");
mainPanel.add(label("Name", false), "");
List<String> defaults = new ArrayList<String>();
defaults.add("Open Challenge");
defaults.add("Ladies Challenge");
defaults.add("Bonus Challenge");
mainPanel.add(autoentry("name", "", defaults), "wrap");
mainPanel.add(label("Size", false), "");
mainPanel.add(select("size", 4, new Integer[] { 4, 8, 16, 32, 64 }, this), "wrap");
}
示例15: setup
import net.miginfocom.swing.MigLayout; //導入依賴的package包/類
@Override
public void setup()
{
displayNodeList = new DisplayNodeList(schemaModel, true);
final JLabel titleLabel = new JLabel(getTitleLabelKey());
title = new I18nTextField(BundleCache.getLanguages());
setLayout(new MigLayout());
add(titleLabel, "gap 50, split 2");
add(title, "grow, wrap");
add(displayNodeList);
changeDetector = new ChangeDetector();
changeDetector.watch(displayNodeList);
changeDetector.watch(title);
}