javax.swing.JScrollPane.setAlignmentX()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中javax.swing.JScrollPane.setAlignmentX()方法的一些代码示例,展示了JScrollPane.setAlignmentX()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.setAlignmentX()方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:setAlignmentX

JScrollPane.setAlignmentX介绍

暂无

代码示例

代码示例来源:origin: apache/pdfbox

private void createView(JPanel headerPanel, JTable table)
{
  panel = new JPanel(new GridBagLayout());
  panel.setPreferredSize(new Dimension(300, 500));
  JScrollPane scrollPane = new JScrollPane(table);
  table.setFillsViewportHeight(true);
  scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.weighty = 0.05;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.anchor = GridBagConstraints.PAGE_START;
  panel.add(headerPanel, gbc);
  gbc.gridy = 2;
  gbc.weighty = 0.9;
  gbc.weightx = 1;
  gbc.fill = GridBagConstraints.BOTH;
  gbc.anchor = GridBagConstraints.BELOW_BASELINE;
  panel.add(scrollPane, gbc);
}

代码示例来源:origin: apache/pdfbox

JScrollPane scrollPane = new JScrollPane(table);
table.setFillsViewportHeight(true);
scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);

代码示例来源:origin: apache/pdfbox

scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);

代码示例来源:origin: nodebox/nodebox

notesScroll.setBorder(BorderFactory.createLineBorder(new Color(137, 137, 137)));
notesScroll.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
notesScroll.setAlignmentX(Component.LEFT_ALIGNMENT);
controlsPanel.add(notesScroll);
controlsPanel.add(Box.createVerticalStrut(10));

代码示例来源:origin: stackoverflow.com

JLabel label = new JLabel("Option");
label.setAlignmentX(Component.LEFT_ALIGNMENT); // Added

panel.add(label);

JLabel a = new JLabel("A");
JLabel b = new JLabel("B");
JLabel c = new JLabel("C");
JLabel d = new JLabel("D");
JLabel e = new JLabel("E");

Box box = Box.createVerticalBox();
box.add(a);
box.add(b);
box.add(c);
box.add(d);
box.add(e);

JScrollPane jscrlpBox = new JScrollPane(box);
jscrlpBox.setPreferredSize(new Dimension(140, 90));
panel.add(jscrlpBox);
jscrlpBox.setAlignmentX(Component.LEFT_ALIGNMENT); // Added

代码示例来源:origin: stackoverflow.com

public NotesPanel(Note note){
  this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  JLabel creatorLabel = new JLabel("Note by "+note.getCreator()+ " @ "+note.getDateCreated());
  creatorLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
  creatorLabel.setHorizontalAlignment(JLabel.LEFT);

  JTextArea notesContentsArea = new JTextArea(note.getContents());
  notesContentsArea.setEditable(false);
  JScrollPane scrollPane = new JScrollPane(notesContentsArea);
  scrollPane.setAlignmentX(JScrollPane.LEFT_ALIGNMENT);

  JLabel editorLabel = new JLabel(" -- Last edited by "+note.getLastEdited() +" at "+note.getDateModified());
  editorLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
  editorLabel.setHorizontalAlignment(JLabel.LEFT);

  this.add(creatorLabel);
  this.add(scrollPane);
  this.add(editorLabel);
  this.setBorder(new BevelBorder(BevelBorder.RAISED));
}

代码示例来源:origin: stackoverflow.com

JButton b1 = new JButton("button1");
 String[] columnNames = { "kolumna 1", "kol 2", "kol3" };
 JTable itemTable = new JTable(new DefaultTableModel(columnNames, 10));
 JScrollPane scrollPane = new JScrollPane(itemTable);
 JButton b2 = new JButton("button2");
 b1.setAlignmentX(Component.LEFT_ALIGNMENT);
 scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
 b2.setAlignmentX(Component.LEFT_ALIGNMENT);
 JPanel panel = new JPanel();
 BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
 panel.setLayout(layout);
 panel.add(b1);
 panel.add(scrollPane);
 panel.add(b2);

代码示例来源:origin: robo-code/robocode

/**
 * Return the robotButtonsScrollPane
 *
 * @return JScrollPane
 */
private JScrollPane getRobotButtonsScrollPane() {
  if (robotButtonsScrollPane == null) {
    robotButtonsScrollPane = new JScrollPane();
    robotButtonsScrollPane.setAutoscrolls(false);
    robotButtonsScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    robotButtonsScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    robotButtonsScrollPane.setAlignmentY(Component.TOP_ALIGNMENT);
    robotButtonsScrollPane.setMaximumSize(new Dimension(113, 32767));
    robotButtonsScrollPane.setPreferredSize(new Dimension(113, 28));
    robotButtonsScrollPane.setAlignmentX(Component.CENTER_ALIGNMENT);
    robotButtonsScrollPane.setMinimumSize(new Dimension(113, 53));
    robotButtonsScrollPane.setViewportView(getRobotButtonsPanel());
  }
  return robotButtonsScrollPane;
}

代码示例来源:origin: freeplane/freeplane

static int showBugReportDialog(final String title, final String question, final int messageType,
                  final Object[] options, final Object firstChoice, final String reportName,
                  final String log) {
    final Box messagePane = Box.createVerticalBox();
    final JLabel messageLabel = new JLabel(question);
    messageLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    messagePane.add(messageLabel);
    messagePane.add(Box.createVerticalStrut(10));
    final JLabel messageLabel2 = new JLabel(reportName);
    messageLabel2.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    messagePane.add(messageLabel2);
    final JTextArea historyArea = new JTextArea(log);
    historyArea.setEditable(false);
    final JScrollPane historyPane = new JScrollPane(historyArea);
    historyPane.setPreferredSize(new Dimension(500, 300));
    historyPane.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    messagePane.add(historyPane);
    final int choice = JOptionPane.showOptionDialog(UITools.getCurrentRootComponent(), messagePane, title,
      JOptionPane.DEFAULT_OPTION, messageType, null, options, firstChoice);
    return choice;
  }
}

代码示例来源:origin: senbox-org/snap-desktop

private JPanel createParametersPanel() {
  JPanel paramsPanel = new JPanel();
  BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS);
  paramsPanel.setLayout(layout);
  AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon("/org/esa/snap/resources/images/icons/Add16.png"), false);
  addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT);
  paramsPanel.add(addParamBut);
  this.paramsTable =  new OperatorParametersTable(this.fakeOperatorDescriptor, appContext);
  JScrollPane tableScrollPane = new JScrollPane(paramsTable);
  tableScrollPane.setPreferredSize(new Dimension(500, 130));
  tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  paramsPanel.add(tableScrollPane);
  addParamBut.addActionListener((ActionEvent e) -> paramsTable.addParameterToTable());
  TitledBorder title = BorderFactory.createTitledBorder("Template Parameters");
  paramsPanel.setBorder(title);
  return paramsPanel;
}

代码示例来源:origin: jtrfp/terminal-recall

public FramebufferStateWindow(TR tr){
setTitle("Framebuffer States");
setSize(280,600);
rootPanel.setLayout(new BoxLayout(rootPanel,BoxLayout.PAGE_AXIS));
scrollPane.setAlignmentX(LEFT_ALIGNMENT);
add(scrollPane);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.tr=tr;
}//end for(descriptors)

代码示例来源:origin: us.ihmc/RobotDataCommunication

JScrollPane scroller = new JScrollPane(result);
scroller.setPreferredSize(new Dimension(300, 250));
scroller.setAlignmentX(LEFT_ALIGNMENT);

代码示例来源:origin: us.ihmc/IHMCRobotDataVisualizer

JScrollPane scroller = new JScrollPane(result);
scroller.setPreferredSize(new Dimension(300, 250));
scroller.setAlignmentX(LEFT_ALIGNMENT);

代码示例来源:origin: us.ihmc/ihmc-robot-data-visualizer

JScrollPane scroller = new JScrollPane(result);
scroller.setPreferredSize(new Dimension(300, 250));
scroller.setAlignmentX(LEFT_ALIGNMENT);

代码示例来源:origin: senbox-org/snap-desktop

@Override
protected JPanel createParametersPanel() {
  JPanel paramsPanel = new JPanel();
  BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS);
  paramsPanel.setLayout(layout);
  AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
  addParamBut.setText("New Parameter");
  addParamBut.setMaximumSize(new Dimension(150, controlHeight));
  addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT);
  addParamBut.setAlignmentY(Component.TOP_ALIGNMENT);
  paramsPanel.add(addParamBut);
  JScrollPane tableScrollPane = new JScrollPane(paramsTable);
  tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  paramsPanel.add(tableScrollPane);
  addParamBut.addActionListener(e -> paramsTable.addParameterToTable());
  return paramsPanel;
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
protected JPanel createParametersPanel() {
  JPanel paramsPanel = new JPanel();
  BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS);
  paramsPanel.setLayout(layout);
  AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
  addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT);
  addParamBut.setAlignmentY(Component.TOP_ALIGNMENT);
  paramsPanel.add(addParamBut);
  int tableWidth = (formWidth - 2 * DEFAULT_PADDING);
  int widths[] = {27, 120, (int)(tableWidth * 0.25), (int)(tableWidth * 0.1), 100, (int)(tableWidth * 0.32), 30};
  for(int i=0; i < widths.length; i++) {
    paramsTable.getColumnModel().getColumn(i).setPreferredWidth(widths[i]);
  }
  JScrollPane tableScrollPane = new JScrollPane(paramsTable);
  tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  paramsPanel.add(tableScrollPane);
  addParamBut.addActionListener(e -> paramsTable.addParameterToTable(new ToolParameterDescriptor("parameterName", String.class), 0));
  TitledBorder title = BorderFactory.createTitledBorder(Bundle.CTL_Panel_OpParams_Border_TitleText());
  paramsPanel.setBorder(title);
  return paramsPanel;
}

代码示例来源:origin: org.codehaus.izpack/izpack-panel

scroller.setAlignmentX(LEFT_ALIGNMENT);
scroller.getViewport().setBackground(Color.white);
scroller.setPreferredSize(new Dimension(width, (this.installData.guiPrefs.height / 3 + 30)));

代码示例来源:origin: senbox-org/snap-desktop

varTable.setRowHeight(20);
JScrollPane scrollPane = new JScrollPane(varTable);
scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
variablesBorderPanel.add(scrollPane);
variablesBorderPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

代码示例来源:origin: org.codehaus.izpack/izpack-panel

scroller.setAlignmentX(LEFT_ALIGNMENT);
add(scroller, NEXT_LINE);

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

scrollpane.setAlignmentX(LEFT_ALIGNMENT);
scrollpane.setAlignmentY(BOTTOM_ALIGNMENT);
return panelOne;

相关文章

JScrollPane类方法