Logo Search packages:      
Sourcecode: pauker version File versions  Download package

static void pauker::program::gui::swing::PaukerFrame::fillTextComponentWithCardSide ( CardSide  cardSide,
JTextComponent  textComponent,
boolean  resetCaret 
) [inline, static]

fills a text area with a card side

Parameters:
cardSide the card side
textComponent the text component
resetCaret if true, the caret is set to position 0

Definition at line 589 of file PaukerFrame.java.

References pauker::program::CardSide::getBackgroundColor(), pauker::program::CardSide::getForegroundColor(), and pauker::program::CardSide::getText().

                                                              {

        // content change (never lazy)
        textComponent.setText(cardSide.getText());
        if (resetCaret) {
            textComponent.setCaretPosition(0);
        }

        setFontAndOrientation(cardSide, textComponent);

        // lazy foregroundColor change
        Color foregroundColor = cardSide.getForegroundColor();
        if (foregroundColor == null) {
            foregroundColor = Color.black;
        }
        Color oldForegroundColor = textComponent.getForeground();
        if (!oldForegroundColor.equals(foregroundColor)) {
            textComponent.setForeground(foregroundColor);
        }

        // lazy backgroundColor change
        Color backgroundColor = cardSide.getBackgroundColor();
        if (backgroundColor == null) {
            backgroundColor = Color.white;
        }
        Color oldBackgroundColor = textComponent.getBackground();
        if (!oldBackgroundColor.equals(backgroundColor)) {
            textComponent.setBackground(backgroundColor);
        }
    }


Generated by  Doxygen 1.6.0   Back to index