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

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

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

JScrollPane.setLayout介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

this.scrollPane.setLayout(new ScrollPaneLayout() {
  @Override
  public void layoutContainer(Container parent) {

代码示例来源:origin: com.synaptix/SynaptixSwing

public void setLayout(LayoutManager layout) {
  if (layout instanceof SyScrollPaneLayout) {
    super.setLayout(layout);
    ((SyScrollPaneLayout) layout).syncWithScrollPane(this);
  } else if (layout == null) {
    super.setLayout(layout);
  } else {
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

@Override
public void setLayout(LayoutManager layout) {
  if (!(layout instanceof JideScrollPaneLayout)) {
    super.setLayout(new JideScrollPaneLayout.UIResource());
  }
  else {
    super.setLayout(layout);
  }
}

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

public void actionPerformed(ActionEvent e) {
  HistoryLogPane.setLayout(new ScrollPaneLayout());//<<<
  history = (JPanel)HistoryLogPane.getViewport().getView();//<<<
  javax.swing.JScrollPane HistoryLogPane = new javax.swing.JScrollPane();
  HistoryLogPane.setLayout(new ScrollPaneLayout()); // edit @kiheru
  HistoryLogPane.setBackground(Color.WHITE);
  HistoryLogPane.setBorder(BorderFactory.createEmptyBorder());
  HistoryLogPane.setLocation(0, 0);
  HistoryLogPane.add(history);
  HistoryLogPane.setSize(new Dimension(history.getSize()));
  history.setPreferredSize(history.getSize());//and we tried: history.setPreferredSize(history.getPreferredSize());
  history.revalidate();//<<<
  System.out.println("SIZE: " + HistoryLogPane.getSize());
  HistoryLocationPanel.removeAll();
  HistoryLocationPanel.add(HistoryLogPane);
  HistoryLocationPanel.repaint();
  HistoryLogPane.repaint();
}

代码示例来源:origin: nl.cloudfarming.client/messaging

/**
 * Construct the panel
 * @param message The message to display
 * @param title Title to display above message-content
 */
public MessageDisplayContentPanel(Message message, String title){
  final JLabel messageLabel = new JLabel(title);
  final JTextArea messageTextContent = new JTextArea();
  if(message != null){
    messageTextContent.setText(message.getMessageText());
  }
      
  this.setLayout(new BorderLayout(5, 5));
  this.setBorder(new EmptyBorder(10, 10, 10, 10) );
    messageTextContent.setEditable(false);
  messageTextContent.setBackground(Color.WHITE);
  messageTextContent.setLineWrap(true);
  messageTextContent.setWrapStyleWord(true);
  messageTextContent.setCaretPosition(0);
  
  final JScrollPane scrollPane = new JScrollPane(messageTextContent);
  scrollPane.setLayout(new ScrollPaneLayout());
  scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  
  this.add(messageLabel, BorderLayout.NORTH);    
  this.add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
protected void installDefaults(JScrollPane scrollpane) {
  ScrollPaneLayout oldLayout = (ScrollPaneLayout) scrollpane.getLayout();
  super.installDefaults(scrollpane);
  scrollpane.setLayout(new MyAdjustedLayout(oldLayout));
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

private void uninstallFromScrollPane() {
 if (theScrollPane == null) {
  return;
 }
 if (thePopupMenu.isVisible()) {
  thePopupMenu.setVisible(false);
 }
 setCornerInScrollPane(null);
 // theScrollPane.removePropertyChangeListener(COMPONENT_ORIENTATION, theComponentOrientationListener);
 theScrollPane.getViewport().removeContainerListener(theViewPortViewListener);
 theScrollPane.setLayout(theFormerLayoutManager);
 theScrollPane = null;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

private void installOnScrollPane(final JScrollPane aScrollPane) {
 if (theScrollPane != null) {
  uninstallFromScrollPane();
 }
 theScrollPane = aScrollPane;
 theFormerLayoutManager = theScrollPane.getLayout();
 theScrollPane.setLayout(new TweakedScrollPaneLayout());
 // theScrollPane.addPropertyChangeListener(COMPONENT_ORIENTATION, theComponentOrientationListener);
 theScrollPane.getViewport().addContainerListener(theViewPortViewListener);
 setCornerInScrollPane(theButton);
 final Component comp = theScrollPane.getViewport().getView();
 theComponent = (comp instanceof JComponent) ? (JComponent) comp : null;
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

void uninstallFromScrollPane() {
  if (theScrollPane == null)
    return;
  if (thePopupMenu.isVisible())
    thePopupMenu.setVisible(false);
  theScrollPane.setCorner(JScrollPane.LOWER_TRAILING_CORNER, null);
  theScrollPane.removePropertyChangeListener(COMPONENT_ORIENTATION,
      propertyChangeListener);
  theScrollPane.getViewport().removeContainerListener(
      theViewPortViewListener);
  theScrollPane.setLayout(theFormerLayoutManager);
  theScrollPane.firePropertyChange("layoutManager", true, false);
  theScrollPane = null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** initialize view
 */
private void initializeView() {
  // adjustment of controlling view
  Component comp = controllingView.getViewport().getView();
  controllingView.setViewportView(comp);
  if (UIManager.getColor ("Table.background") != null) { // NOI18N
    getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N
  }
  
  // both views share one vertical scrollbar
  setVerticalScrollBar(controllingView.getVerticalScrollBar());
  
  ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView);
  setLayout(spl);
  spl.syncWithScrollPane(this);
  
  spl = new EnablingScrollPaneLayout(this);
  controllingView.setLayout(spl);
  spl.syncWithScrollPane(controllingView);
  
  table.setBorder(null);
  // table like header
  header = new JTable().getTableHeader().getDefaultRenderer()
    .getTableCellRendererComponent(null, " ", false, false, 0, 0); // NOI18N
  
  MouseInputListener mouseHandler = new MouseDragHandler();
  header.addMouseListener(mouseHandler);
  header.addMouseMotionListener(mouseHandler);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** initialize view
 */
private void initializeView() {
  // adjustment of controlling view
  Component comp = controllingView.getViewport().getView();
  controllingView.setViewportView(comp);
  if (UIManager.getColor("Table.background") != null) { // NOI18N
    getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N
  }
  // both views share one vertical scrollbar
  setVerticalScrollBar(controllingView.getVerticalScrollBar());
  ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView);
  setLayout(spl);
  spl.syncWithScrollPane(this);
  spl = new EnablingScrollPaneLayout(this);
  controllingView.setLayout(spl);
  spl.syncWithScrollPane(controllingView);
  table.setBorder(null);
  // table like header
  header = new JTable().getTableHeader().getDefaultRenderer().getTableCellRendererComponent(
      null, " ", false, false, 0, 0
    ); // NOI18N
  MouseInputListener mouseHandler = new MouseDragHandler();
  header.addMouseListener(mouseHandler);
  header.addMouseMotionListener(mouseHandler);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** initialize view
 */
private void initializeView() {
  // adjustment of controlling view
  Component comp = controllingView.getViewport().getView();
  controllingView.setViewportView(comp);
  if (UIManager.getColor ("Table.background") != null) { // NOI18N
    getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N
  }
  
  // both views share one vertical scrollbar
  setVerticalScrollBar(controllingView.getVerticalScrollBar());
  
  ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView);
  setLayout(spl);
  spl.syncWithScrollPane(this);
  
  spl = new EnablingScrollPaneLayout(this);
  controllingView.setLayout(spl);
  spl.syncWithScrollPane(controllingView);
  
  table.setBorder(null);
  // table like header
  header = new JTable().getTableHeader().getDefaultRenderer()
    .getTableCellRendererComponent(null, " ", false, false, 0, 0); // NOI18N
  
  MouseInputListener mouseHandler = new MouseDragHandler();
  header.addMouseListener(mouseHandler);
  header.addMouseMotionListener(mouseHandler);
}

代码示例来源:origin: org.java.net.substance/substance

@Override
protected void installDefaults(final JScrollPane scrollpane) {
  super.installDefaults(scrollpane);
  if (SubstanceCoreUtilities.toDrawWatermark(scrollpane)
      && (SubstanceLookAndFeel.getCurrentSkin(scrollpane)
          .getWatermark() != null)) {
    scrollpane.setOpaque(false);
    scrollpane.getViewport().setOpaque(false);
  }
  scrollpane.setLayout(new AdjustedLayout((ScrollPaneLayout) scrollpane
      .getLayout()));
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      // System.out.println("Installing");
      installTableHeaderCornerFiller(scrollpane);
    }
  });
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
protected void installDefaults(final JScrollPane scrollpane) {
  super.installDefaults(scrollpane);
  if (SubstanceCoreUtilities.toDrawWatermark(scrollpane)
      && (SubstanceLookAndFeel.getCurrentSkin(scrollpane)
          .getWatermark() != null)) {
    scrollpane.setOpaque(false);
    scrollpane.getViewport().setOpaque(false);
  }
  scrollpane.setLayout(new AdjustedLayout((ScrollPaneLayout) scrollpane
      .getLayout()));
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      // System.out.println("Installing");
      installTableHeaderCornerFiller(scrollpane);
    }
  });
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

protected void installDefaults(JScrollPane scrollpane) 
{
LookAndFeel.installBorder(scrollpane, "ScrollPane.border");
LookAndFeel.installColorsAndFont(scrollpane, 
  "ScrollPane.background", 
  "ScrollPane.foreground", 
    "ScrollPane.font");
  Border vpBorder = scrollpane.getViewportBorder();
  if ((vpBorder == null) ||( vpBorder instanceof UIResource)) {
  vpBorder = UIManager.getBorder("ScrollPane.viewportBorder");
  scrollpane.setViewportBorder(vpBorder);
  }
  
  scrollpane.setLayout(new TonicScrollPaneLayout());
  scrollpane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new UpperRightCorner());
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
protected void uninstallDefaults(JScrollPane c) {
  Component upperRight = c.getCorner(JScrollPane.UPPER_RIGHT_CORNER);
  if (upperRight instanceof UIResource) {
    c.setCorner(JScrollPane.UPPER_RIGHT_CORNER, null);
  }
  Component upperLeft = c.getCorner(JScrollPane.UPPER_LEFT_CORNER);
  if (upperLeft instanceof UIResource) {
    c.setCorner(JScrollPane.UPPER_LEFT_CORNER, null);
  }
  LayoutManager lm = scrollpane.getLayout();
  if (lm instanceof AdjustedLayout) {
    c.setLayout(((AdjustedLayout) lm).delegate);
  }
  super.uninstallDefaults(c);
}

代码示例来源:origin: org.java.net.substance/substance

@Override
protected void uninstallDefaults(JScrollPane c) {
  Component upperRight = c.getCorner(JScrollPane.UPPER_RIGHT_CORNER);
  if (upperRight instanceof UIResource) {
    c.setCorner(JScrollPane.UPPER_RIGHT_CORNER, null);
  }
  Component upperLeft = c.getCorner(JScrollPane.UPPER_LEFT_CORNER);
  if (upperLeft instanceof UIResource) {
    c.setCorner(JScrollPane.UPPER_LEFT_CORNER, null);
  }
  LayoutManager lm = scrollpane.getLayout();
  if (lm instanceof AdjustedLayout) {
    c.setLayout(((AdjustedLayout) lm).delegate);
  }
  super.uninstallDefaults(c);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

initComponents();
scrollPane.setLayout(new PlacardScrollPaneLayout());
scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

initComponents();
scrollPane.setLayout(new PlacardScrollPaneLayout());
scrollPane.setBorder(new EmptyBorder(0,0,0,0));

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

void installOnScrollPane(JScrollPane aScrollPane) {
  if (theScrollPane != null)
    uninstallFromScrollPane();
  theScrollPane = aScrollPane;
  theFormerLayoutManager = theScrollPane.getLayout();
  theScrollPane.setLayout(new TweakedScrollPaneLayout());
  theScrollPane.firePropertyChange("layoutManager", false, true);
  theScrollPane.addPropertyChangeListener(COMPONENT_ORIENTATION,
      propertyChangeListener);
  theScrollPane.getViewport().addContainerListener(
      theViewPortViewListener);
  theScrollPane.setCorner(JScrollPane.LOWER_TRAILING_CORNER, theButton);
  Component comp = theScrollPane.getViewport().getView();
  theComponent = (comp instanceof JComponent) ? (JComponent) comp : null;
  this.theButton.setIcon(LafWidgetRepository.getRepository()
      .getLafSupport().getSearchIcon(
          UIManager.getInt("ScrollBar.width") - 3,
          theScrollPane.getComponentOrientation()));
  theScrollPane.doLayout();
}

相关文章

JScrollPane类方法