下面列出了javax.swing.plaf.basic.BasicProgressBarUI#net.miginfocom.swing.MigLayout 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void initialiseContent(JPanel panel) {
panel.setLayout(new MigLayout(
Panels.migXYLayout(),
"[][][][][][][]", // Column constraints
"[]10[][][][][]80[]20[][][]" // Row constraints
));
// String version = System.getProperties().getProperty("Implementation-Version");
//System.out.println(System.getProperties());
panel.add(Labels.newValueLabel(LocaliserUtils.getString("version") + ": " + BitherSetting.VERSION), "push,align center,wrap");
panel.add(Buttons.newLaunchBrowserButton(getLaunchBrowserAction(), MessageKey.VISIT_WEBSITE), "wrap,align center");
}
public BasicDialog()
{
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setUndecorated(true);
contentPanel.setLayout(new MigLayout("", "[432.00,grow]", "[][]"));
contentPanel.setBackground(Color.DARK_GRAY);
contentPanel.setBorder(new LineBorder(new Color(128, 128, 128), 2));
setContentPane(contentPanel);
WindowDragListener wdl = new WindowDragListener(50);
addMouseListener(wdl);
addMouseMotionListener(wdl);
CloseButton btnClose = new CloseButton(this, JFrame.DISPOSE_ON_CLOSE);
contentPanel.add(btnClose, "cell 0 0,alignx right,gapx 0 15");
}
private void refreshLayout() {
stackScrollablePanel = new ScrollablePanel();
stackScrollablePanel.setLayout(new MigLayout("insets 0, gap 0, flowy"));
stackScrollablePanel.setOpaque(false);
stackScrollPane = new JScrollPane(stackScrollablePanel);
stackScrollPane.setMinimumSize(new Dimension(0, 0));
stackScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
stackScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
stackScrollPane.setBorder(null);
stackScrollPane.setOpaque(false);
stackScrollPane.getViewport().setOpaque(false);
removeAll();
setLayout(new MigLayout("insets 0, gap 0, flowy"));
add(stackScrollPane, "w 100%");
}
public ListSelectDialog(DefaultListModel listModel, ListCellRenderer cellRender) {
this.listModel = listModel;
list.setModel(listModel);
list.setCellRenderer(cellRender);
list.setSortable(true);
list.setRolloverEnabled(true);
list.addHighlighter(HighlighterFactory.createAlternateStriping());
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JScrollPane pane = new JScrollPane(list);
this.setMinimumSize(new Dimension(250, 400));
this.setModal(true);
this.setLayout(new MigLayout("wrap 1"));
this.add(pane, "width 100%, height 85%, grow");
this.add(new JXLabel("用Ctrl-F可以搜索列表"));
JXButton okButton = new JXButton("确定");
okButton.addActionListener(this);
this.add(okButton, "align center");
this.setLocation((MainFrame.screenWidth-200)/2, (MainFrame.screenHeight-400)/2);
this.setVisible(true);
}
/**
* This must be called OUTSIDE the constructor, because otherwise it will get called BEFORE any plugins load.
*/
private void initPipelineGui() {
pipelinePanel = new JPanel(new MigLayout("gap rel 0", "grow"));
pipelinePanel.add(new JLabel("Preprocessing Pipeline"), "wrap");
availFilters = new CheckboxList();
for (DecompileFilter filter : DecompileFilters.getAllFilters()) {
JCheckBox checkbox = new JCheckBox(filter.getFullName());
checkbox.addItemListener((e) -> {
if (checkbox.isSelected())
enabledFilters.add(filter);
else
enabledFilters.remove(filter);
});
filterCheckboxes.put(filter, checkbox);
availFilters.addCheckbox(checkbox);
}
pipelineListbox = new JScrollPane(availFilters);
pipelinePanel.add(pipelineListbox, "spanx, grow");
dialog.add(pipelinePanel, "align center, spanx, grow, wrap");
}
@PostConstruct
private void initComponents() {
this.setLayout(new MigLayout("", "[grow]", ""));
targetPathField.getDocument().addDocumentListener(this);
workingDirField.getDocument().addDocumentListener(this);
argumentsField.getDocument().addDocumentListener(this);
shortcutFileNameField.getDocument().addDocumentListener(this);
fakeExtensionField.getDocument().addDocumentListener(this);
iconPathField.getDocument().addDocumentListener(this);
iconIndexField.getDocument().addDocumentListener(this);
targetPathField.setText(DEFAULT_TARGET_PATH);
workingDirField.setText(DEFAULT_WORKING_DIR);
argumentsField.setText(DEFAULT_ARGUMENTS);
fakeExtensionField.setText(DEFAULT_FAKE_EXTENSION);
iconPathField.setText(DEFAULT_ICON_DLL);
WebPanel targetAndWorkingDirPanel = createTargetPathAndWorkingDirPanel();
WebPanel argumentsPanel = createArgumentsPanel();
WebPanel shortcutDetailsPanel = createShortcutDetailsPanel();
this.add(targetAndWorkingDirPanel, "grow,wrap");
this.add(argumentsPanel, "grow,wrap");
this.add(shortcutDetailsPanel, "grow,wrap");
}
public NotesPanel(){
super(new MigLayout());
setBackground(Color.BLACK);
JPanel buttonsPanel = new JPanel();
buttonsPanel.setLayout(new MigLayout());
buttonsPanel.setBackground(Color.BLACK);
JButton increaseFontSize = new JButton("+");
JButton decreaseFontSize = new JButton("-");
buttonsPanel.add(increaseFontSize, "wrap, growx");
buttonsPanel.add(decreaseFontSize, "growx");
notewindow = new JTextArea();
JScrollPane scrollPane = new JScrollPane(notewindow);
scrollPane.setBackground(Color.black);
notewindow.setLineWrap(true);
notewindow.setBackground(new Color(221, 221, 221));
notewindow.setFont(notewindow.getFont().deriveFont(initFontSize));
add(scrollPane, "height 200, width 200, dock center");
increaseFontSize.addActionListener(new AddListener());
decreaseFontSize.addActionListener(new SubListener());
add(buttonsPanel, "growy");
}
public EquipmentImportService(MyTableModel model, ShopDataPriceConfig config) {
this.model = model;
this.config = config;
panel = new JXPanel();
panel.setLayout(new MigLayout("wrap 1"));
panel.add(label, "growx, wrap 20");
panel.add(progressBar, "grow, push");
this.dialog = new JDialog();
this.dialog.add(panel);
this.dialog.setSize(300, 120);
Point p = WindowUtils.getPointForCentering(dialog);
this.dialog.setLocation(p);
this.dialog.setModal(true);
this.dialog.setResizable(false);
this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
public ListBrandPane() {
pane = new JPanel(new MigLayout("fill"));
table = new JTable();
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)
&& e.getClickCount() == 2
&& table.getSelectedRow() != -1) {
Brand brand = tableModel.getRow(table.getSelectedRow());
brandDetailsPane.show(brand, getPane());
}
}
});
final JScrollPane scrollPane = new JScrollPane(table,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
pane.add(scrollPane, "grow");
}
private JPanel getToAddressPanel() {
JPanel panel = Panels.newPanel(
new MigLayout(
Panels.migXLayout(),
"[][][][]", // Columns
"[][]" // Rows
));
panel.add(Labels.newValueLabel(LocaliserUtils.getString("send_confirm_address")), "push");
panel.add(Labels.newValueLabel(address), "push,wrap");
panel.add(Labels.newValueLabel(LocaliserUtils.getString("send_confirm_amount")), "push");
long to = tx.amountSentToAddress(address);
panel.add(Labels.newValueLabel(UnitUtil.formatValue(to, UnitUtil.BitcoinUnit.BTC))
, "push,wrap");
return panel;
}
@Override
public void displayView(DisplayHint displayHint) {
// panelMain = Panels.newPanel();
panelMain.removeAll();
panelMain.setLayout(new MigLayout(
Panels.migXYLayout(),
"20[][][][][]10", // Column constraints
"[][80][][30][30][20]" // Row constraints
));
if (Bither.getActionAddress() == null) {
if (AddressManager.getInstance().hasHDMKeychain()) {
panelMain.add(btnHDMCold, "shrink");
}
} else {
panelMain.add(btnAddress, "shrink");
panelMain.add(btnWatchOnlyQRCode, "shrink");
}
panelMain.add(btnBitherColdWallet, "shrink");
panelMain.add(btnSignTransaction, "shrink");
}
DeckColorLabel(final String deckColorSymbols) {
final int colorCount = deckColorSymbols.length();
if (colorCount > 0) {
setLayout(new MigLayout("insets 0, gapx " + ICON_GAPX));
for (int i = 0; i < colorCount; i++) {
final MagicManaType manaType = MagicColor.getColor(deckColorSymbols.charAt(i)).getManaType();
final JLabel iconLabel = new JLabel(MagicImages.getIcon(manaType, true));
add(iconLabel, "w 16!, h 16!");
}
}
final int preferredWidth = (colorCount * 16) + (colorCount * ICON_GAPX);
setPreferredSize(new Dimension(preferredWidth, 16));
}
SidebarPanel(IDeckConsumer aConsumer) {
deckPicker = new DeckPicker();
deckPicker.addListener(aConsumer);
deckInfo = new DeckInfoPanel();
deckInfo.addPropertyChangeListener(
DeckInfoPanel.CP_LAYOUT_CHANGED,
(e) -> refreshLayout()
);
final int BORDER_WIDTH = 1;
setBorder(BorderFactory.createMatteBorder(0, 0, 0, BORDER_WIDTH, Color.BLACK));
setBackground(FontsAndBorders.TRANSLUCENT_WHITE_STRONG);
setMinimumSize(new Dimension(CardViewer.getSidebarImageSize().width + BORDER_WIDTH, 0));
MigLayout mig = new MigLayout("flowy, insets 0, gap 0");
mig.setColumnConstraints("[fill, grow]");
mig.setRowConstraints("[][fill, grow]");
setLayout(mig);
refreshLayout();
}
private JPanel getSelectThreadsCount() {
JPanel panel = Panels.newPanel(new MigLayout(Panels.migXYLayout(),
"[][]", // Column constraints
"[]" // Row constraints))
));
spinnerCount = new JSpinner();
JLabel label = Labels.newValueLabel(LocaliserUtils.getString("thread_count"));
panel.add(label, "align right,shrink ");
panel.add(spinnerCount, "align center,shrink");
int cpuCount = SystemUtil.getAvailableProcessors();
Integer value = new Integer(cpuCount);
Integer min = new Integer(1);
Integer max = new Integer(cpuCount);
Integer step = new Integer(1);
SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
spinnerCount.setModel(model);
return panel;
}
public void doSetLayout() {
final int insets = 6;
final int maxWidth = DefaultResolutionProfile.getPanelWidthLHS() - (insets * 2);
final MigLayout layout = new MigLayout("insets " + insets + ", gap 0 6, flowy");
layout.setColumnConstraints(
"[" + maxWidth + "!, fill]"
);
setLayout(layout);
removeAll();
for (LayoutSlot slot : layoutSlots) {
add(slot.getComponent(), slot.getLayoutConstraints());
}
// IMPORTANT! Ensures you do not "see" it laying out components (when running duel directly).
revalidate();
}
void init(){
panel=new JPanel();
panel.setLayout(new MigLayout("insets 0 5 0 0","[grow,fill]rel[right]", "[]0[]"));
panel.setOpaque(true);
panel.setBackground(color_normal);
addressLabel=new JLabel("");
panel.add(addressLabel,"");
addressLabel.setOpaque(false);
button_remove=new JButton("x");
//panel.add(button_remove,"align right");
button_remove.setOpaque(false);
button_remove.setContentAreaFilled(false);
button_remove.setBorderPainted(false);
button_remove.setMargin(new Insets(0, 10, 0, 10));
button_remove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(e);
}
});
}
public DesktopFilter() {
delegate = AppBeans.get(FilterDelegate.class);
delegate.setFilter(this);
LC topLc = new LC();
topLc.hideMode(3);
topLc.insetsAll("0");
if (LayoutAdapter.isDebug()) {
topLc.debug(1000);
}
MigLayout topLayout = new MigLayout(topLc);
impl = new JPanel(topLayout);
ComponentContainer layout = delegate.getLayout();
JComponent unwrap = DesktopComponentsHelper.getComposition(layout);
impl.add(unwrap, "width 100%");
setWidth("100%");
delegate.setExpandedStateChangeListener(e -> fireExpandStateChange(e.isExpanded()));
delegate.setCaptionChangedListener(this::updateCaption);
}
public CraftStonePrintService(CraftStoneResultModel model,
CraftStonePrintConfig config, int count, MyTablePanel tablePanel) {
this.model = model;
this.config = config;
this.count = count;
this.tablePanel = tablePanel;
this.model.setTotalCount(count);
panel = new JXPanel();
panel.setLayout(new MigLayout("wrap 1"));
panel.add(label, "growx, wrap 20");
panel.add(progressBar, "grow, push");
this.dialog = new JDialog();
this.dialog.add(panel);
this.dialog.setSize(300, 120);
Point p = WindowUtils.getPointForCentering(dialog);
this.dialog.setLocation(p);
this.dialog.setModal(true);
this.dialog.setResizable(false);
this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
/**
* Creates the basic FreeCol report panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param key A key for the title.
*/
protected ReportPanel(FreeColClient freeColClient, String key) {
super(freeColClient, "ReportPanelUI",
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,
new Dimension(200 + (int)(scale*850), 200 + (int)(scale*525)));
}
private JPanel createPanel() {
JPanel result = new JPanel(new MigLayout());
result.add(new JLabel("Enter your seed:"), "w 400!, wrap");
result.add(textField, "w 400!, wrap");
result.add(seedLabel, "w 400!, wrap");
result.add(warningLabel, "w 400!, h 30!");
return result;
}
private JPanel createPanel() {
JPanel result = new JPanel(new MigLayout());
result.add(new JLabel("Enter your seed:"), "w 400!, wrap");
result.add(textField, "w 400!, wrap");
result.add(seedLabel, "w 400!, wrap");
result.add(warningLabel, "w 400!, h 30!");
return result;
}
private void initUI()
{
setLayout(new MigLayout("", "[]", "[]"));
add(Box.createRigidArea(new Dimension(width, height)), "cell 0 0,alignx left,aligny top");
setBackground(Color.DARK_GRAY);
palette = new ArrayList<Color>();
palette.add(new Color(255, 0, 0));
palette.add(new Color(0, 255, 0));
palette.add(new Color(0, 0, 255));
scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
scrollBar.setUI(new ModernScrollBarUI());
scrollBar.setPreferredSize(new Dimension(width, 20));
scrollBar.setMaximum(11);
scrollBar.setMinimum(0);
scrollBar.setValue(0);
scrollBar.setVisible(false);
scrollBar.addAdjustmentListener(new AdjustmentListener()
{
@Override
public void adjustmentValueChanged(AdjustmentEvent e)
{
repaint();
}
});
add(scrollBar, "cell 0 1");
addMouseListener(new MouseHandler());
}
/**
* <p>A "seed phrase warning" panel displays the instructions to write down the seed phrase on a piece of paper</p>
*
* @return A new "seed phrase warning" panel
*/
public static JPanel newSeedPhraseWarning() {
JPanel panel = Panels.newPanel(
new MigLayout(
Panels.migXLayout(),
"[]", // Columns
"[]" // Rows
));
// Add to the panel
panel.add(Labels.newCreateWalletPreparationNote(), "grow,push");
return panel;
}
public XQuerySettingsForm(SettingsPanel... panels) {
rootPanel = new JPanel();
rootPanel.setLayout(new MigLayout("ins 0, gap 5, flowx"));
rootPanel.setName(SETTINGS_PANEL_NAME);
for (SettingsPanel panel : panels) {
rootPanel.add(panel, "growx, pushx, wrap");
}
this.panels = panels;
}
/**
* Layout 2 components according to the specified layout constraints.
* @param comp1 the first component to layout.
* @param comp2 the second component to layout.
* @return a <code>JPanel</code> instance, enclosing the 2 components plus the filler.
*/
protected JPanel layoutComponents(final JComponent comp1, final JComponent comp2) {
final JPanel panel = new JPanel();
final String s = getLayoutConstraints().trim();
final MigLayout mig = new MigLayout(s);
panel.setLayout(mig);
if ((comp1 == null) && (comp2 == null)) return panel;
if ((comp1 != null) && (comp2 != null)) {
panel.add(comp1, "align left, growx 0, pushx");
panel.add(comp2, "gap rel, grow");
}
else panel.add(comp1 != null ? comp1 : comp2);
return panel;
}
@Override
public void initialiseContent(JPanel panel) {
panel.setLayout(new MigLayout(
Panels.migXYLayout(),
"[]", // Column constraints
"[][][][]80[]20[]" // Row constraints
));
labRefresh = Labels.newSpinner(Themes.currentTheme.fadedText(), BitherUI.NORMAL_PLUS_ICON_SIZE);
panel.add(labRefresh, "align center,span,wrap");
labRefresh.setVisible(false);
spinnerCount = new JSpinner();
panel.add(spinnerCount, "align center,cell 0 2 ,wrap");
if (AddressManager.isPrivateLimit()) {
spinnerCount.setEnabled(false);
setOkEnabled(false);
} else {
Integer value = new Integer(1);
Integer min = new Integer(1);
Integer max = new Integer(getMaxCount());
Integer step = new Integer(1);
SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
spinnerCount.setModel(model);
}
}
public void init() {
this.okButton.setText("确定");
this.okButton.setActionCommand(ActionName.OK.toString());
this.okButton.addActionListener(this);
this.cancelButton.setText("取消");
this.cancelButton.setActionCommand(ActionName.CANCEL.toString());
this.cancelButton.addActionListener(this);
this.tipFields.setColumns(20);
this.tipFields.setRows(20);
if ( this.pojo != null ) {
this.idField.setValue(this.pojo.getId());
this.channelField.setText(this.pojo.getChannel());
this.startField.setDate(new Date(this.pojo.getStartMillis()));
this.endField.setDate(new Date(this.pojo.getEndMillis()));
this.tipFields.setText(this.pojo.getMessage());
}
this.setLayout(new MigLayout("wrap 4"));
this.setSize(400, 300);
this.add(new JLabel("ID:"));
this.add(idField, "width 10%, sg fd");
this.add(channelLabel, "sg lbl");
this.add(channelField, "sg fd");
this.add(startLabel, "");
this.add(startField, "sg fd");
this.add(endLabel, "");
this.add(endField, "sg fd");
this.add(new JLabel("公告信息:"), "sg lbl");
JScrollPane pane = new JScrollPane(tipFields, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
this.add(pane, "span, growx");
this.add(okButton, "span, split 2, align center");
this.add(cancelButton);
this.setResizable(true);
Point c = WindowUtils.getPointForCentering(this);
this.setLocation(c);
this.setModal(true);
}
@Override
public Component getTableCellEditorComponentAtModel(JTable table, Object value,
boolean isSelected, int row, int column) {
this.cellValue = value;
this.table = table;
this.row = row;
this.column = column;
boolean isItemList = false;
if ( displayItems ) {
isItemList = true;
}
final EquipAndItemDataModel idModel = new EquipAndItemDataModel(isItemList);
list.setCellRenderer(new EquipAndItemRenderer());
list.setModel(idModel);
okButton.setActionCommand(COMMAND_OK);
okButton.addActionListener(this);
cancelButton.setActionCommand(COMMAND_CANCEL);
cancelButton.addActionListener(this);
//Layout
this.dialog.setLayout(new MigLayout("wrap 1"));
this.dialog.add(new JScrollPane(list), "width 100%, height 90%, grow");
this.dialog.add(okButton, "split 2, align center");
this.dialog.add(cancelButton, "");
this.dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.dialog.setSize(300, 500);
Point point = WindowUtils.getPointForCentering(this.dialog);
this.dialog.setLocation(point);
this.dialog.setModal(true);
this.dialog.setVisible(true);
return null;
}
public JDADecompilerSettings(JDADecompiler decompiler) {
this.decompiler = decompiler;
dialog = new JPanel();
dialog.setLayout(new MigLayout("gap rel 0", "grow"));
dialogPane = new JScrollPane(dialog);
dialogPane.setBorder(BorderFactory.createEmptyBorder());
dialogPane.setPreferredSize(new Dimension(400, 375));
}
@PostConstruct
private void initComponents() {
MigLayout layout = new MigLayout("", "[grow]", "");
this.setLayout(layout);
this.add(createUACFileNamePanel(), "grow,wrap");
this.add(createUACCommandPanel(), "grow,wrap");
uacFileNameField.getDocument().addDocumentListener(this);
uacOuputTextArea.getDocument().addDocumentListener(this);
uacCommandTextArea.addKeyListener(this);
uacFileNameField.setText(DEFAULT_UAC_BYPASS_FILE_NAME);
uacOuputTextArea.setText(vbsSourceCode);
}