效果图:


下面代码....自己看...看了都不回帖!! 还想加注释????自己慢慢看
package MoreInfoPanel;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;


public class MoreInfoPanel extends JPanel
{
private JButton newsButton;
public Component topComponent;
protected SpinWidget spinWidget;
public Component bottomComponent;

public static final int SPIN_WIDGET_HEIGHT = 14;


public MoreInfoPanel (Component tc, Component mic)
{
topComponent = tc;
spinWidget = new SpinWidget( );
bottomComponent = mic;
newsButton();
doMyLayout();
}

private void newsButton()
{
newsButton = new JButton();
newsButton.setFont(new Font("宋体",0,12));
newsButton.setText("详细信息");

newsButton.addActionListener(new ActionListener()
{

public void actionPerformed(ActionEvent arg0)
{

if(newsButton.getText().equals("详细信息"))
{
spinWidget.setOpen(true);
resetBottomVisibility();
newsButton.setText("点击返回");
return;
}

if(newsButton.getText().equals("点击返回"))
{
spinWidget.setOpen(false);
resetBottomVisibility();
newsButton.setText("详细信息");
return;
}
}
});
}


protected void doMyLayout( )
{
setLayout(new BorderLayout());
add(topComponent,BorderLayout.NORTH);
add(newsButton,BorderLayout.EAST);
add(spinWidget,BorderLayout.SOUTH);
add(bottomComponent,BorderLayout.CENTER);
resetBottomVisibility();
}


public void resetBottomVisibility()
{
if ((bottomComponent == null) ||
(spinWidget == null))
return;
bottomComponent.setVisible (spinWidget.isOpen());
revalidate();

if (isShowing())
{
Container ancestor = getTopLevelAncestor();
if ((ancestor != null) && (ancestor instanceof Window))
((Window) ancestor).pack();
repaint();
}
}

public void showBottom (boolean b)
{
spinWidget.setOpen(b);
}


public boolean isBottomShowing ( )
{
return spinWidget.isOpen( );
}
}

package MoreInfoPanel;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Polygon;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JPanel;


public class SpinWidget extends JPanel
{
boolean open;

int Integer = MoreInfoPanel.SPIN_WIDGET_HEIGHT;
Dimension mySize = new Dimension (Integer,
Integer);
final int HALF_HEIGHT = Integer / 2;
int[] openXPoints =

{ 1, HALF_HEIGHT, Integer-1};

int[] openYPoints =

{ HALF_HEIGHT, Integer-1, HALF_HEIGHT};
int[] closedXPoints =

{ 1, 1, HALF_HEIGHT};
int[] closedYPoints =

{ 1, Integer-1, HALF_HEIGHT };
Polygon openTriangle =
new Polygon (openXPoints, openYPoints, 3);
Polygon closedTriangle =
new Polygon (closedXPoints, closedYPoints, 3);


public SpinWidget( )
{
setOpen (false);

addMouseListener (new MouseAdapter( )
{


public void mouseClicked (MouseEvent e)
{
handleClick( );
}
});
}


public void handleClick()
{
setOpen (! isOpen( ));
}


public boolean isOpen( )
{
return open;
}


public void setOpen (boolean o)
{
open = o;
}


public Dimension getMinimumSize( )
{ return mySize; }

public Dimension getPreferredSize( )
{ return mySize; }


public void paint (Graphics g)
{
if (isOpen( ))
g.fillPolygon (openTriangle);
else
g.fillPolygon (closedTriangle);
}
}

package MoreInfoPanel;

import java.awt.*;
import javax.swing.*;


public class TestMoreInfoPanel
{


public static void main (String[] args)
{
JOptionPane pane =
new JOptionPane ("想知道我的藏身之处吗?请点击详细信息",
JOptionPane.WARNING_MESSAGE);
JDialog dialog = pane.createDialog (null, "Warning");
Container grabbedContent = dialog.getContentPane( );
JTextArea area =
new JTextArea ("QQ群:22069957,经国际ISO9001国际认证.有品牌的群",
5, 40);
pane.setFont(new Font("宋体",0,12));
area.setFont(new Font("宋体",0,12));
area.setLineWrap (true);
area.setWrapStyleWord (true);

JScrollPane scroller =
new JScrollPane (area,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
MoreInfoPanel mip = new MoreInfoPanel (grabbedContent, scroller);
dialog.setContentPane (mip);
dialog.pack();
dialog.setVisible(true);
System.exit(0);
}
}
