Example usage for javax.swing JScrollPane setPreferredSize

List of usage examples for javax.swing JScrollPane setPreferredSize

Introduction

In this page you can find the example usage for javax.swing JScrollPane setPreferredSize.

Prototype

@BeanProperty(preferred = true, description = "The preferred size of the component.")
public void setPreferredSize(Dimension preferredSize) 

Source Link

Document

Sets the preferred size of this component.

Usage

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.objeto.PainelObjeto.java

private void initComponentsEscalavel(

        ArrayList<FerramentaDescricaoModel> erros) {
    Ferramenta_Objetos.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    scrollPaneDescricao = new G_TextAreaSourceCode();
    scrollPaneDescricao.setTipoHTML();/*from   ww w .  j ava 2s . co  m*/
    new OnChange(scrollPaneDescricao, this);
    //parentFrame.setJMenuBar(this.criaMenuBar());

    // parentFrame.setTitle("Associador de rtulos");
    tableLinCod = new TabelaDescricao(erros);
    arTextPainelCorrecao = new ArTextPainelCorrecao();

    // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel();

    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();
    // panelLegenda = new JPanel();

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    pnSetaDescricao.setLayout(new BorderLayout());
    spTextoDescricao = new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo();
    conteudoDoAlt = new JTextArea();
    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();
    lbTemp = new JLabel();
    pnBotoes = new JPanel();
    btnSalvar = new JMenuItem(GERAL.BTN_SALVAR);

    adicionar = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    // setJMenuBar(this.criaMenuBar());
    // ======== this ========
    // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos
    // controles:");
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(scrollPaneDescricao.getTextPane(), salvar,
            new JMenuItem(), parentFrame);
    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));

    // ======== pnRegra ========
    {
        pnRegra.setBorder(criaBorda(Ferramenta_Objetos.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(Ferramenta_Objetos.REGRAP1);
        lbRegras2.setText(Ferramenta_Objetos.REGRAP2);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }

    // G_URLIcon.setIcon(lbTemp,
    // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg");

    // ======== pnDescricao ========

    // ---- Salvar ----
    salvar.setText(Ferramenta_Objetos.BTN_SALVAR);
    salvar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            salvarActionPerformed(e);
        }
    });

    salvar.setToolTipText(Ferramenta_Objetos.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_SALVAR);
    salvar.setBounds(10, 0, 150, 25);

    abrir.setText(Ferramenta_Objetos.BTN_ABRIR);
    abrir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AbrirActionPerformed(e);
        }
    });

    abrir.setToolTipText(Ferramenta_Objetos.DICA_ABRIR);
    abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_ABRIR_HTML);
    abrir.setBounds(165, 0, 150, 25);

    cancelar.setText(Ferramenta_Objetos.TELA_ANTERIOR);
    cancelar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            CancelarActionPerformed(e);
        }
    });

    cancelar.setToolTipText(Ferramenta_Objetos.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_TELA_ANTERIOR);
    cancelar.setBounds(320, 0, 150, 25);

    // ======== pnParticRotulo ========

    // pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT));

    // ======== spParticRotulo ========
    {
        // spTextoDescricao.setViewportView(conteudoDoAlt);
    }

    // lbRegras1.setText(Reparo_Imagens.REGRAP2);
    // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

    // pnRegra.add(lbRegras1);

    JScrollPane sp = new JScrollPane();

    sp.setViewportView(conteudoDoAlt);
    sp.setPreferredSize(new Dimension(500, 300));
    sp.setBorder(criaBorda(Ferramenta_Objetos.CONTEUDO_ALTER));
    // pnSetaDescricao.add(spTextoDescricao,cons);

    pnSetaDescricao.setPreferredSize(new Dimension(400, 60));

    // ======== pnListaErros ========
    {

        pnListaErros.setBorder(criaBorda(Ferramenta_Objetos.LISTA_ERROS));
        pnListaErros.setLayout(new BorderLayout());
        // ======== scrollPanetabLinCod ========
        {
            scrollPanetabLinCod.setViewportView(tableLinCod);
        }
        pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    }
    // ======== pnBotoes ========
    {

        // pnBotoes.setBorder(criaBorda(""));

        pnBotoes.setLayout(null);
        // ---- adicionar ----
        adicionar.setText(Ferramenta_Objetos.BTN_ADICIONAR);
        adicionar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                adicionarActionPerformed(e);
            }
        });
    }

    /*
     * Colocar os controles
     */
    pnRegra.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.add(pnRegra, BorderLayout.NORTH);
    scrollPaneDescricao.setBorder(criaBorda(""));
    scrollPaneDescricao.setBackground(CoresDefault.getCorPaineis());

    JSplitPane splitPane = null;

    Dimension minimumSize = new Dimension(0, 0);
    // JScrollPane ajudaScrollPane = new
    // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.setMinimumSize(minimumSize);
    sp.setPreferredSize(new Dimension(150, 90));
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, scrollPaneDescricao);
    splitPane.setOneTouchExpandable(true);
    // splitPane.set
    // splitPane.setDividerLocation(0.95);
    int w = parentFrame.getWidth();
    int s = w / 4;
    splitPane.setDividerLocation(s);

    // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER);
    regraFonteBtn.add(splitPane, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH);
    regraFonteBtn.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(regraFonteBtn);

    JPanel textoErrosBtn = new JPanel();
    textoErrosBtn.setLayout(new BorderLayout());
    pnSetaDescricao.setBackground(CoresDefault.getCorPaineis());
    pnSetaDescricao.add(pnBotoes);
    aplicar = new JButton();
    aplicar.setBounds(3, 3, 120, 30);
    pnBotoes.add(aplicar);

    // ---- aplicarRotulo ----
    aplicar.setEnabled(false);
    aplicar.setText(Ferramenta_Objetos.BTN_APLICAR);
    aplicar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            aplicarRotuloActionPerformed(e);
        }
    });

    aplicar.setToolTipText(Ferramenta_Objetos.DICA_APLICAR);
    aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_APLICAR);
    aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_APLICAR);
    textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH);

    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));
    pnSalvarCancelar.add(salvar);
    pnSalvarCancelar.add(abrir);
    pnSalvarCancelar.add(cancelar);

    if (!original) {
        reverter = new JButton("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaDescricaoObjetosPArq(TxtBuffer.getContentOriginal());
                setVisible(true);
            }

        });
        //reverter.setActionCommand("Reverter");
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(485, 0, 150, 25);
        pnSalvarCancelar.add(reverter);
    }

    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH);
    pnListaErros.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    contentPane.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(textoErrosBtn);
    if (tableLinCod.getRowCount() == 0)
        tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS);
    this.setVisible(true);

}

From source file:components.SharedModelDemo.java

public SharedModelDemo() {
    super(new BorderLayout());

    Vector data = new Vector(7);
    String[] columnNames = { "French", "Spanish", "Italian" };
    String[] oneData = { "un", "uno", "uno" };
    String[] twoData = { "deux", "dos", "due" };
    String[] threeData = { "trois", "tres", "tre" };
    String[] fourData = { "quatre", "cuatro", "quattro" };
    String[] fiveData = { "cinq", "cinco", "cinque" };
    String[] sixData = { "six", "seis", "sei" };
    String[] sevenData = { "sept", "siete", "sette" };

    //Build the model.
    SharedDataModel dataModel = new SharedDataModel(columnNames);
    dataModel.addElement(oneData);/*from  w  w  w.ja  v a 2 s  .com*/
    dataModel.addElement(twoData);
    dataModel.addElement(threeData);
    dataModel.addElement(fourData);
    dataModel.addElement(fiveData);
    dataModel.addElement(sixData);
    dataModel.addElement(sevenData);

    list = new JList(dataModel);
    list.setCellRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList l, Object value, int i, boolean s, boolean f) {
            String[] array = (String[]) value;
            return super.getListCellRendererComponent(l, array[0], i, s, f);
        }
    });

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    JScrollPane listPane = new JScrollPane(list);

    table = new JTable(dataModel);
    table.setSelectionModel(listSelectionModel);
    JScrollPane tablePane = new JScrollPane(table);

    //Build control area (use default FlowLayout).
    JPanel controlPane = new JPanel();
    String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" };

    final JComboBox comboBox = new JComboBox(modes);
    comboBox.setSelectedIndex(2);
    comboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String newMode = (String) comboBox.getSelectedItem();
            if (newMode.equals("SINGLE_SELECTION")) {
                listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) {
                listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            } else {
                listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            }
            output.append("----------" + "Mode: " + newMode + "----------" + newline);
        }
    });
    controlPane.add(new JLabel("Selection mode:"));
    controlPane.add(comboBox);

    //Build output area.
    output = new JTextArea(10, 40);
    output.setEditable(false);
    JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    //Do the layout.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    add(splitPane, BorderLayout.CENTER);

    JPanel topHalf = new JPanel();
    topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.X_AXIS));
    JPanel listContainer = new JPanel(new GridLayout(1, 1));
    listContainer.setBorder(BorderFactory.createTitledBorder("List"));
    listContainer.add(listPane);
    JPanel tableContainer = new JPanel(new GridLayout(1, 1));
    tableContainer.setBorder(BorderFactory.createTitledBorder("Table"));
    tableContainer.add(tablePane);
    tablePane.setPreferredSize(new Dimension(300, 100));
    topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    topHalf.add(listContainer);
    topHalf.add(tableContainer);

    topHalf.setMinimumSize(new Dimension(400, 50));
    topHalf.setPreferredSize(new Dimension(400, 110));
    splitPane.add(topHalf);

    JPanel bottomHalf = new JPanel(new BorderLayout());
    bottomHalf.add(controlPane, BorderLayout.NORTH);
    bottomHalf.add(outputPane, BorderLayout.CENTER);
    //XXX: next line needed if bottomHalf is a scroll pane:
    //bottomHalf.setMinimumSize(new Dimension(400, 50));
    bottomHalf.setPreferredSize(new Dimension(450, 135));
    splitPane.add(bottomHalf);
}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

protected void setTablePane() {

    dataPanel.removeAll();/*  w ww  .  j  av  a  2s.  c  o  m*/

    JScrollPane tablePanel = new JScrollPane(dataTable);
    tablePanel.setRowHeaderView(headerTable);
    dataPanel.add(tablePanel);

    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3));

    dataPanel.add(new JScrollPane(st));
    dataPanel.validate();
}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

public void updateEditableHeader(TableColumnModel aColumnModel) {
    dTableHeader = new EditableHeader(aColumnModel);
    /*for (int i=0; i<aColumnModel.getColumnCount(); i++){
       System.out.println("H "+aColumnModel.getColumn(i).getHeaderValue());
    }*///from  w ww .java 2  s  .c  o  m
    dTableHeader.setEditingColumn(-1);
    dataTable.setTableHeader(dTableHeader);
    dataTable.validate();

    dataPanel.removeAll();

    JTableHeader corner = headerTable.getTableHeader();
    corner.setReorderingAllowed(false);
    corner.setResizingAllowed(false);
    JScrollPane tablePanel = new JScrollPane(dataTable);
    tablePanel.setRowHeaderView(headerTable);
    tablePanel.setCorner(JScrollPane.UPPER_LEFT_CORNER, corner);
    new JScrollPaneAdjuster(tablePanel);
    new JTableRowHeaderResizer(tablePanel).setEnabled(true);
    dataPanel.add(tablePanel);

    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3));
    dataPanel.add(new JScrollPane(st));
    dataPanel.validate();
    //System.out.println("table Header updated");
}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

/**
 * make the show_all panel//from w ww . j av  a 2s.  c om
 */
protected void setMixPanel() {
    dataPanel2.removeAll();
    graphPanel2.removeAll();

    graphPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS));
    if (chartPanel != null)
        graphPanel2.add(chartPanel);
    if (legendPanelOn) {
        if (legendPanel != null)
            legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5));
        JScrollPane legendPane = new JScrollPane(legendPanel);

        legendPane.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5));
        graphPanel2.add(legendPane);
    }
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    JScrollPane st2 = new JScrollPane(mapPanel);
    st2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(st2);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

/**
 * clear data panel/* w  w w.j a v a2s.c  om*/
 *
 */
public void resetTable() {

    //   System.out.println("resetTable get called");
    for (int i = 0; i < columnNumber; i++)
        columnNames[i] = new String(DEFAULT_HEADER + (i + 1));

    tModel = new javax.swing.table.DefaultTableModel(dataObject, columnNames);
    hModel = new DefaultTableModel(0, 1);

    for (int i = 0; i < tModel.getRowCount(); i++)
        hModel.addRow(new Object[] { (i + 1) + ":" });

    dataTable = new JTable(tModel);
    /*   System.out.println("here2");
       dataTable.getTableHeader().addMouseListener(new MouseAdapter(){  
           public void mouseClicked(MouseEvent e) {  
     TableColumnModel colModel = dataTable.getColumnModel();
       int columnModelIndex = colModel.getColumnIndexAtX(e.getX());
       selectedHeaderColumnIndex = colModel.getColumn(columnModelIndex)
           .getModelIndex();
               
        System.out.println("mouseClicked haeder "+selectedHeaderColumnIndex);
     }  
       });*/
    /*final JTableHeader heading = dataTable.getTableHeader();
    heading.addMouseListener(new MouseAdapter(){  
        public void mouseClicked(MouseEvent e) {  
           selectedHeaderColumnIndex = heading.columnAtPoint(e.getPoint());  
           System.out.println("mouseClicked haeder "+selectedHeaderColumnIndex);
        }  
     });  */
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    dataTable.setCellSelectionEnabled(true);
    dataTable.setColumnSelectionAllowed(true);
    dataTable.setRowSelectionAllowed(true);

    columnModel = dataTable.getColumnModel();
    dTableHeader = new EditableHeader(columnModel);
    dataTable.setTableHeader(dTableHeader);

    listIndex = new int[dataTable.getColumnCount()];
    for (int j = 0; j < listIndex.length; j++)
        listIndex[j] = 1;

    hookTableAction();

    headerTable = new JTable(hModel);
    headerTable.setCellSelectionEnabled(false);
    LookAndFeel.installColorsAndFont(headerTable, "TableHeader.background", "TableHeader.foreground",
            "TableHeader.font");
    headerTable.setIntercellSpacing(new Dimension(0, 0));
    Dimension d = headerTable.getPreferredScrollableViewportSize();
    d.width = headerTable.getPreferredSize().width;
    headerTable.setPreferredScrollableViewportSize(d);
    headerTable.setRowHeight(dataTable.getRowHeight());
    headerTable.setDefaultRenderer(Object.class, new RowHeaderRenderer());
    JTableHeader corner = headerTable.getTableHeader();
    corner.setReorderingAllowed(false);
    corner.setResizingAllowed(false);

    //      summaryPanel.setPreferredSize(new Dimension(CHART_SIZE_X,CHART_SIZE_Y/2));
    summaryPanel.removeAll();

    dataPanel.removeAll();
    JScrollPane tablePanel = new JScrollPane(dataTable);
    tablePanel.setRowHeaderView(headerTable);
    tablePanel.setCorner(JScrollPane.UPPER_LEFT_CORNER, corner);
    new JScrollPaneAdjuster(tablePanel);
    new JTableRowHeaderResizer(tablePanel).setEnabled(true);
    dataPanel.add(tablePanel);

    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3));
    dataPanel.add(new JScrollPane(st));
    dataPanel.validate();

}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

/**
 * setup GUI layout for the data panel including datatable and summary textArea
 *
 *///from   w w  w.  j av  a  2s .c o  m
protected void initTable() {

    tModel = new DefaultTableModel(dataObject, columnNames);
    hModel = new DefaultTableModel(0, 1);

    dataTable = new JTable(tModel);
    /*   System.out.println("here");
       dataTable.getTableHeader().addMouseListener(new MouseAdapter(){  
           public void mouseClicked(MouseEvent e) {  
     TableColumnModel colModel = dataTable.getColumnModel();
       int columnModelIndex = colModel.getColumnIndexAtX(e.getX());
       selectedHeaderColumnIndex = colModel.getColumn(columnModelIndex)
           .getModelIndex();
               
        System.out.println("mouseClicked haeder "+selectedHeaderColumnIndex);
     }  
       });*/

    /*final JTableHeader heading = dataTable.getTableHeader();
    dataTable.addMouseListener(new MouseAdapter(){  
        public void mouseClicked(MouseEvent e) {  
           selectedHeaderColumnIndex = heading.columnAtPoint(e.getPoint());  
           System.out.println("mouseClicked haeder "+selectedHeaderColumnIndex);
        }  
     });  */
    dataTable.addKeyListener(this);
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);

    for (int i = 0; i < tModel.getRowCount(); i++)
        hModel.addRow(new Object[] { (i + 1) + ":" });

    headerTable = new JTable(hModel);

    headerTable.setCellSelectionEnabled(false);
    headerTable.setEnabled(false);
    headerTable.setGridColor(Color.gray);
    headerTable.setShowGrid(true);
    LookAndFeel.installColorsAndFont(headerTable, "TableHeader.background", "TableHeader.foreground",
            "TableHeader.font");
    headerTable.setIntercellSpacing(new Dimension(0, 0));
    Dimension d = headerTable.getPreferredScrollableViewportSize();
    d.width = headerTable.getPreferredSize().width;
    headerTable.setPreferredScrollableViewportSize(d);
    headerTable.setRowHeight(dataTable.getRowHeight());
    headerTable.setDefaultRenderer(Object.class, new RowHeaderRenderer());

    JTableHeader corner = headerTable.getTableHeader();
    corner.setReorderingAllowed(false);
    corner.setResizingAllowed(false);

    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }
    columnModel = dataTable.getColumnModel();
    dTableHeader = new EditableHeader(columnModel);
    dataTable.setTableHeader(dTableHeader);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    dataTable.setCellSelectionEnabled(true);
    dataTable.setColumnSelectionAllowed(true);
    dataTable.setRowSelectionAllowed(true);

    hookTableAction();

    dataPanel = new JPanel();

    summaryPanel = new JTextArea();
    //      summaryPanel.setPreferredSize(new Dimension(CHART_SIZE_X,CHART_SIZE_Y/2));
    Color bg = dataPanel.getBackground();
    summaryPanel.setBackground(bg);
    summaryPanel.setEditable(false);
    summaryPanel.setForeground(Color.BLACK);

    dataPanel.setLayout(new BoxLayout(dataPanel, BoxLayout.Y_AXIS));
    JScrollPane tablePanel = new JScrollPane(dataTable);

    tablePanel.setRowHeaderView(headerTable);
    tablePanel.setCorner(JScrollPane.UPPER_LEFT_CORNER, corner);
    new JScrollPaneAdjuster(tablePanel);

    new JTableRowHeaderResizer(tablePanel).setEnabled(true);

    dataPanel.add(tablePanel);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3));
    dataPanel.add(new JScrollPane(st));

    dataPanel.validate();
}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

/**This method initializes the Gui, by setting up the basic tabbedPanes.*/
public void init() {

    depMax = 1;/*from ww w  . j ava  2 s  . co  m*/
    indMax = 1;
    chartTitle = this.getClass().getName();
    chartTitle = chartTitle.substring(chartTitle.lastIndexOf(".") + 1);
    String fileName = "demo" + System.getProperty("file.separator") + chartTitle + ".html";

    url = Chart.class.getResource(fileName);

    setName(chartTitle);

    //Get frame of the applet
    //frame = getFrame(this.getContentPane());

    // Create the toolBar
    toolBar = new JToolBar();
    createActionComponents(toolBar);
    this.getContentPane().add(toolBar, BorderLayout.NORTH);

    tabbedPanelContainer = new JTabbedPane();

    dataObject = new Object[rowNumber][columnNumber];
    columnNames = new String[columnNumber];
    independentList = new ArrayList<Integer>();
    dependentList = new ArrayList<Integer>();
    for (int i = 0; i < columnNumber; i++)
        columnNames[i] = new String(DEFAULT_HEADER + (i + 1));

    initTable();
    initGraphPanel();
    initMapPanel();
    initMixPanel();
    mixPanelContainer = new JScrollPane(mixPanel);
    mixPanelContainer.setPreferredSize(new Dimension(600, CHART_SIZE_Y + 100));

    addTabbedPane(GRAPH, graphPanel);
    addTabbedPane(DATA, dataPanel);
    addTabbedPane(MAPPING, bPanel);
    addTabbedPane(ALL, mixPanelContainer);

    tabbedPanelContainer.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == ALL) {
                mixPanel.removeAll();
                setMixPanel();
                mixPanel.validate();
            } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == GRAPH) {
                graphPanel.removeAll();
                //setGraphPanel();
                //graphPanel.validate();
                setChart();

            } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == DATA) {
                //               
                setTablePane();
            } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == MAPPING) {
                bPanel.removeAll();
                mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y));
                bPanel.add(mapPanel, BorderLayout.CENTER);
                bPanel.validate();
            }
        }
    });
    bPanel.addComponentListener(new ComponentListener() {
        public void componentResized(ComponentEvent e) {
        }

        public void componentMoved(ComponentEvent e) {
        }

        public void componentShown(ComponentEvent e) {
            // resultPanelTextArea.append("sucess");
            // System.out.print("Success");
            // Add code here for updating the Panel to show proper heading
            paintMappingLists(listIndex);
        }

        public void componentHidden(ComponentEvent e) {
        }

    });

    // the right side (including top and bottom panels)
    statusTextArea = new JTextPane(); //right side lower
    statusTextArea.setEditable(false);
    JScrollPane statusContainer = new JScrollPane(statusTextArea);
    statusContainer.setPreferredSize(new Dimension(600, 140));

    if (SHOW_STATUS_TEXTAREA) {
        JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(tabbedPanelContainer),
                statusContainer);
        container.setContinuousLayout(true);
        container.setDividerLocation(0.6);
        this.getContentPane().add(container, BorderLayout.CENTER);
    } else {

        this.getContentPane().add(new JScrollPane(tabbedPanelContainer), BorderLayout.CENTER);
    }

    updateStatus(url);
}

From source file:net.pms.encoders.MEncoderVideo.java

@Override
public JComponent config() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation);

    FormLayout layout = new FormLayout(colSpec, ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);
    builder.setOpaque(false);//  w w  w  .  ja v  a2 s .c  o m

    CellConstraints cc = new CellConstraints();

    checkBox = new JCheckBox(Messages.getString("MEncoderVideo.0"));
    checkBox.setContentAreaFilled(false);

    if (configuration.getSkipLoopFilterEnabled()) {
        checkBox.setSelected(true);
    }

    checkBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setSkipLoopFilterEnabled((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"),
            FormLayoutUtil.flip(cc.xyw(1, 1, 15), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    mencodermt = new JCheckBox(Messages.getString("MEncoderVideo.35"));
    mencodermt.setContentAreaFilled(false);

    if (configuration.getMencoderMT()) {
        mencodermt.setSelected(true);
    }

    mencodermt.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            configuration.setMencoderMT(mencodermt.isSelected());
        }
    });

    mencodermt.setEnabled(Platform.isWindows() || Platform.isMac());

    builder.add(mencodermt, FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation));
    builder.add(checkBox, FormLayoutUtil.flip(cc.xyw(3, 3, 12), colSpec, orientation));

    noskip = new JCheckBox(Messages.getString("MEncoderVideo.2"));
    noskip.setContentAreaFilled(false);

    if (configuration.isMencoderNoOutOfSync()) {
        noskip.setSelected(true);
    }

    noskip.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderNoOutOfSync((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    builder.add(noskip, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation));

    JButton button = new JButton(Messages.getString("MEncoderVideo.29"));
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel codecPanel = new JPanel(new BorderLayout());
            final JTextArea textArea = new JTextArea();
            textArea.setText(configuration.getMencoderCodecSpecificConfig());
            textArea.setFont(new Font("Courier", Font.PLAIN, 12));
            JScrollPane scrollPane = new JScrollPane(textArea);
            scrollPane.setPreferredSize(new java.awt.Dimension(900, 100));

            final JTextArea textAreaDefault = new JTextArea();
            textAreaDefault.setText(DEFAULT_CODEC_CONF_SCRIPT);
            textAreaDefault.setBackground(Color.WHITE);
            textAreaDefault.setFont(new Font("Courier", Font.PLAIN, 12));
            textAreaDefault.setEditable(false);
            textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync());
            JScrollPane scrollPaneDefault = new JScrollPane(textAreaDefault);
            scrollPaneDefault.setPreferredSize(new java.awt.Dimension(900, 450));

            JPanel customPanel = new JPanel(new BorderLayout());
            intelligentsync = new JCheckBox(Messages.getString("MEncoderVideo.3"));
            intelligentsync.setContentAreaFilled(false);

            if (configuration.isMencoderIntelligentSync()) {
                intelligentsync.setSelected(true);
            }

            intelligentsync.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    configuration.setMencoderIntelligentSync((e.getStateChange() == ItemEvent.SELECTED));
                    textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync());

                }
            });

            JLabel label = new JLabel(Messages.getString("MEncoderVideo.33"));
            customPanel.add(label, BorderLayout.NORTH);
            customPanel.add(scrollPane, BorderLayout.SOUTH);

            codecPanel.add(intelligentsync, BorderLayout.NORTH);
            codecPanel.add(scrollPaneDefault, BorderLayout.CENTER);
            codecPanel.add(customPanel, BorderLayout.SOUTH);

            while (JOptionPane.showOptionDialog(
                    SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), codecPanel,
                    Messages.getString("MEncoderVideo.34"), JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {
                String newCodecparam = textArea.getText();
                DLNAMediaInfo fakemedia = new DLNAMediaInfo();
                DLNAMediaAudio audio = new DLNAMediaAudio();
                audio.setCodecA("ac3");
                fakemedia.setCodecV("mpeg4");
                fakemedia.setContainer("matroska");
                fakemedia.setDuration(45d * 60);
                audio.getAudioProperties().setNumberOfChannels(2);
                fakemedia.setWidth(1280);
                fakemedia.setHeight(720);
                audio.setSampleFrequency("48000");
                fakemedia.setFrameRate("23.976");
                fakemedia.getAudioTracksList().add(audio);
                String result[] = getSpecificCodecOptions(newCodecparam, fakemedia,
                        new OutputParams(configuration), "dummy.mpg", "dummy.srt", false, true);

                if (result.length > 0 && result[0].startsWith("@@")) {
                    String errorMessage = result[0].substring(2);
                    JOptionPane.showMessageDialog(
                            SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), errorMessage,
                            Messages.getString("Dialog.Error"), JOptionPane.ERROR_MESSAGE);
                } else {
                    configuration.setMencoderCodecSpecificConfig(newCodecparam);
                    break;
                }
            }
        }
    });
    builder.add(button, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation));

    forcefps = new JCheckBox(Messages.getString("MEncoderVideo.4"));
    forcefps.setContentAreaFilled(false);
    if (configuration.isMencoderForceFps()) {
        forcefps.setSelected(true);
    }
    forcefps.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderForceFps(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    builder.add(forcefps, FormLayoutUtil.flip(cc.xyw(1, 7, 2), colSpec, orientation));

    yadif = new JCheckBox(Messages.getString("MEncoderVideo.26"));
    yadif.setContentAreaFilled(false);
    if (configuration.isMencoderYadif()) {
        yadif.setSelected(true);
    }
    yadif.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderYadif(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(yadif, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation));

    scaler = new JCheckBox(Messages.getString("MEncoderVideo.27"));
    scaler.setContentAreaFilled(false);
    scaler.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderScaler(e.getStateChange() == ItemEvent.SELECTED);
            scaleX.setEnabled(configuration.isMencoderScaler());
            scaleY.setEnabled(configuration.isMencoderScaler());
        }
    });
    builder.add(scaler, FormLayoutUtil.flip(cc.xyw(3, 5, 7), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.28"), FormLayoutUtil
            .flip(cc.xy(9, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    scaleX = new JTextField("" + configuration.getMencoderScaleX());
    scaleX.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            try {
                configuration.setMencoderScaleX(Integer.parseInt(scaleX.getText()));
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse scaleX from \"" + scaleX.getText() + "\"");
            }
        }
    });
    builder.add(scaleX, FormLayoutUtil.flip(cc.xy(11, 5), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.30"), FormLayoutUtil
            .flip(cc.xy(13, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    scaleY = new JTextField("" + configuration.getMencoderScaleY());
    scaleY.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            try {
                configuration.setMencoderScaleY(Integer.parseInt(scaleY.getText()));
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse scaleY from \"" + scaleY.getText() + "\"");
            }
        }
    });
    builder.add(scaleY, FormLayoutUtil.flip(cc.xy(15, 5), colSpec, orientation));

    if (configuration.isMencoderScaler()) {
        scaler.setSelected(true);
    } else {
        scaleX.setEnabled(false);
        scaleY.setEnabled(false);
    }

    builder.addLabel(Messages.getString("MEncoderVideo.6"),
            FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation));
    mencoder_custom_options = new JTextField(configuration.getMencoderCustomOptions());
    mencoder_custom_options.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderCustomOptions(mencoder_custom_options.getText());
        }
    });
    builder.add(mencoder_custom_options, FormLayoutUtil.flip(cc.xyw(3, 13, 13), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.93"),
            FormLayoutUtil.flip(cc.xy(1, 15), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.28") + " (%)", FormLayoutUtil
            .flip(cc.xy(1, 15, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    ocw = new JTextField(configuration.getMencoderOverscanCompensationWidth());
    ocw.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderOverscanCompensationWidth(ocw.getText());
        }
    });
    builder.add(ocw, FormLayoutUtil.flip(cc.xy(3, 15), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.30") + " (%)",
            FormLayoutUtil.flip(cc.xy(5, 15), colSpec, orientation));
    och = new JTextField(configuration.getMencoderOverscanCompensationHeight());
    och.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderOverscanCompensationHeight(och.getText());
        }
    });
    builder.add(och, FormLayoutUtil.flip(cc.xy(7, 15), colSpec, orientation));

    cmp = builder.addSeparator(Messages.getString("MEncoderVideo.8"),
            FormLayoutUtil.flip(cc.xyw(1, 17, 15), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    builder.addLabel(Messages.getString("MEncoderVideo.16"), FormLayoutUtil
            .flip(cc.xy(1, 27, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));

    mencoder_noass_scale = new JTextField(configuration.getMencoderNoAssScale());
    mencoder_noass_scale.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssScale(mencoder_noass_scale.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.17"),
            FormLayoutUtil.flip(cc.xy(5, 27), colSpec, orientation));

    mencoder_noass_outline = new JTextField(configuration.getMencoderNoAssOutline());
    mencoder_noass_outline.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssOutline(mencoder_noass_outline.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.18"),
            FormLayoutUtil.flip(cc.xy(9, 27), colSpec, orientation));

    mencoder_noass_blur = new JTextField(configuration.getMencoderNoAssBlur());
    mencoder_noass_blur.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssBlur(mencoder_noass_blur.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.19"),
            FormLayoutUtil.flip(cc.xy(13, 27), colSpec, orientation));

    mencoder_noass_subpos = new JTextField(configuration.getMencoderNoAssSubPos());
    mencoder_noass_subpos.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssSubPos(mencoder_noass_subpos.getText());
        }
    });

    builder.add(mencoder_noass_scale, FormLayoutUtil.flip(cc.xy(3, 27), colSpec, orientation));
    builder.add(mencoder_noass_outline, FormLayoutUtil.flip(cc.xy(7, 27), colSpec, orientation));
    builder.add(mencoder_noass_blur, FormLayoutUtil.flip(cc.xy(11, 27), colSpec, orientation));
    builder.add(mencoder_noass_subpos, FormLayoutUtil.flip(cc.xy(15, 27), colSpec, orientation));

    ass = new JCheckBox(Messages.getString("MEncoderVideo.20"));
    ass.setContentAreaFilled(false);
    ass.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e != null) {
                configuration.setMencoderAss(e.getStateChange() == ItemEvent.SELECTED);
            }
        }
    });
    builder.add(ass, FormLayoutUtil.flip(cc.xy(1, 23), colSpec, orientation));
    ass.setSelected(configuration.isMencoderAss());
    ass.getItemListeners()[0].itemStateChanged(null);

    fc = new JCheckBox(Messages.getString("MEncoderVideo.21"));
    fc.setContentAreaFilled(false);
    fc.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderFontConfig(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(fc, FormLayoutUtil.flip(cc.xyw(3, 23, 5), colSpec, orientation));
    fc.setSelected(configuration.isMencoderFontConfig());

    assdefaultstyle = new JCheckBox(Messages.getString("MEncoderVideo.36"));
    assdefaultstyle.setContentAreaFilled(false);
    assdefaultstyle.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderAssDefaultStyle(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(assdefaultstyle, FormLayoutUtil.flip(cc.xyw(8, 23, 4), colSpec, orientation));
    assdefaultstyle.setSelected(configuration.isMencoderAssDefaultStyle());

    builder.addLabel(Messages.getString("MEncoderVideo.92"),
            FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation));
    subq = new JTextField(configuration.getMencoderVobsubSubtitleQuality());
    subq.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderVobsubSubtitleQuality(subq.getText());
        }
    });
    builder.add(subq, FormLayoutUtil.flip(cc.xyw(3, 29, 1), colSpec, orientation));

    configuration.addConfigurationListener(new ConfigurationListener() {
        @Override
        public void configurationChanged(ConfigurationEvent event) {
            if (event.getPropertyName() == null) {
                return;
            }
            if ((!event.isBeforeUpdate())
                    && event.getPropertyName().equals(PmsConfiguration.KEY_DISABLE_SUBTITLES)) {
                boolean enabled = !configuration.isDisableSubtitles();
                ass.setEnabled(enabled);
                assdefaultstyle.setEnabled(enabled);
                fc.setEnabled(enabled);
                mencoder_noass_scale.setEnabled(enabled);
                mencoder_noass_outline.setEnabled(enabled);
                mencoder_noass_blur.setEnabled(enabled);
                mencoder_noass_subpos.setEnabled(enabled);
                ocw.setEnabled(enabled);
                och.setEnabled(enabled);
                subq.setEnabled(enabled);

                if (enabled) {
                    ass.getItemListeners()[0].itemStateChanged(null);
                }
            }
        }
    });

    JPanel panel = builder.getPanel();

    // Apply the orientation to the panel and all components in it
    panel.applyComponentOrientation(orientation);

    return panel;
}

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel messageBox() {
    JPanel tstats3 = new JPanel(new BorderLayout());
    /*tstats3.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Message Log"),
                BorderFactory.createRaisedBevelBorder()));*/
    JPanel trnPanel = new JPanel(new GridLayout(1, 1));
    trnPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Statistics"),
            BorderFactory.createRaisedBevelBorder()));
    JPanel trn1 = new JPanel(new FlowLayout());
    trn1.add(new JLabel("Transmit (writes in Gbps): "));
    trnLTX = new JTextField("0.0", 5);
    trnLTX.setEditable(false);/*  w  w w. j a  v a  2  s  .c o m*/
    trn1.add(trnLTX);
    trn1.add(new JLabel("Receive (reads in Gbps): "));
    trnLRX = new JTextField("0.0", 5);
    trnLRX.setEditable(false);
    trn1.add(trnLRX);
    trnPanel.add(trn1);

    textArea = new CustomTextPane();

    final JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Message Log"),
            BorderFactory.createRaisedBevelBorder()));
    scrollPane.setPreferredSize(new Dimension(scrollPane.getPreferredSize().width, 100));
    //scrollPane.setMaximumSize(new Dimension(scrollPane.getPreferredSize().width, 100));  
    // keep scrollbar at end showing latest messages
    /*scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
    BoundedRangeModel brm = scrollPane.getVerticalScrollBar().getModel();
    boolean wasAtBottom = true;
    @Override
    public void adjustmentValueChanged(AdjustmentEvent ae) {
        if (!brm.getValueIsAdjusting() &&
                 (scrollPane.) == brm.getMaximum()) {
            if (wasAtBottom)
                brm.setValue(brm.getMaximum());
                       
         } else
                wasAtBottom = ((brm.getValue() + brm.getExtent()) == brm.getMaximum());
            
        }
    });*/

    textArea.setEditable(false);

    tstats3.add(scrollPane, BorderLayout.CENTER);

    tstats3.add(trnPanel, BorderLayout.PAGE_START);
    return tstats3;
    // testPanel.add(tstats3, BorderLayout.PAGE_END);
}