luty 12, 2009 @ 9:53 am (tips)
Method Described at:
http://www.javalobby.org/forums/thread.jspa?forumID=61&threadID=14179
<code>
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JTextPane;
public class AntiAliasedTextPane extends JTextPane {
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
super.paintComponent(g2);
}
}
</code>
Dodaj komentarz
styczeń 26, 2009 @ 1:49 pm (artysta)
pgp –verify file_with_certificate
Dodaj komentarz
styczeń 16, 2009 @ 2:32 pm (tips)
Assumption: We have list of values in excel sheet1
row1: A1
row2: A2
row3: A3
row4: A4
row5: B1
row6: B2
row7: B3
row8: B4
Task: We want to transpose this data in excel sheet2 into form.
row1: A1A2A3A4
row2: B1B2B3B4
So every four cells in four rows is transposed to one row with four columns
It could be done using following Visual Basic Macro:
<code>
- Sub Macro()
- RowIndex = 1
- Do
- Sheets(“Sheet1″).Select
- With Sheets(“Sheet1″)
- Range(.Cells(RowIndex, 1), .Cells(RowIndex + 3, 1)).Select
- End With
- Selection.Copy
- Sheets(“Sheet2″).Select
- RowIndexPaste = Round(RowIndex / 4) + 1
- With Sheets(“Sheet2″)
- Range(.Cells(RowIndexPaste, 1), .Cells(RowIndexPaste, 1)).Select
- End With
- Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
- False, Transpose:=True
- RowIndex = RowIndex + 4
- Loop While Sheets(“Sheet1″).Cells(RowIndex, 1).Value <> “”
- End Sub
</code>
Macro check until check empty line.
If you know easiest way to resolve this task, let me know!
Dodaj komentarz
styczeń 13, 2009 @ 4:06 pm (tips)
Należy użyć krótkiej nazwy katalogu.
opis:
|
|
Re[3]: How do I convert long to short pathnames?
Topic: IO
Rick LaFleur, Jun 22, 2004 [replies:2]
Caution, I think there may be a problem with this solution (not that I know a better one) or at least there was when I looked into this last.
First is handling spaces … you need to know to drop em. So if you create a folder called “this is the first test” it will have a short name of THISIS~1.
The second issue though is more tricky. If originally there were three folders called:
"this is the first test"
"this is the second test"
"this is the third test"
They would have short names of THISIS~1, THISIS~2, and THISIS~3. So far, fine.
But, what happens if the “this is the first test” folder is deleted? On my system I show the two remaining folders listed as THISIS~2 and THISIS~3. That is, the short name seems to be cooked in when the folder is created.
Which you might think is good if you are hard coding the path name into your application.
However, if you come along later and see only the two folders, you might assume they were ~1 and ~2, not ~2 and ~3, and using the ~2 to access the ’second’ directory would result in the wrong one.
Worse, if you create a new folder called “this is the fourth test” it’s short name is THISIS~1, not ~4. You can just imagine what that would do to your application.
Confusing, huh?
Best solution I’ve found (and hope there is a better one) is the dumb dir /X command and parse results.
|
z http://www.jguru.com/faq/viewquestion.jsp?EID=768691
Dodaj komentarz
styczeń 8, 2009 @ 4:27 pm (tips)
<code>
- JTable table = new JTable() {
- public Component prepareRenderer(TableCellRenderer renderer,
- int rowIndex, int vColIndex) {
- Component c = super.prepareRenderer(renderer, rowIndex,
- vColIndex);
- if (c instanceof JComponent) {
- JComponent jc = (JComponent) c;
- jc.setToolTipText((String) getValueAt(rowIndex,
- vColIndex));
- }
- return c;
- }
- };
</code>
Dodaj komentarz
styczeń 8, 2009 @ 3:11 pm (tips)
Jakoś po angielski lepszy do tych określeń.
Zadanie: Jest do wykonania czasochłonna operacja, chcemy pokazywać postęp bez blokowania całego GUI.
Definicja przycisku który wykonuje akcję:
<code>
- jButton = new JButton();
- jButton.setText(“Perform Test”);
- jButton.setMnemonic(KeyEvent.VK_ENTER);
- jButton.setToolTipText(“Press me!”);
- jButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- performTestButtonAction(e);
- }
- });
</code>
obsługa zadania jest w metodzie performTestButtonAction
<code>
- private void performTestButtonAction(java.awt.event.ActionEvent e) {
- final SwingWorker worker = new SwingWorker() {
- public Object construct() {
-
/* pokaż komponent postępu */
- jProgressBar.setVisible(true);
- for (int j = 0; j <= 100; j += 10) {
-
/* aktualizacja wartości w komponencie postępu */
- jProgressBar.setValue(j);
-
/* symulacja że coś robimy – tu wstawiamy kod do wykonania*/
- try {Thread.sleep(250);}catch (Exception e) {e.printStackTrace();}
- }
- }
-
/* zgaś komponent postępu */
- jProgressBar.setVisible(false);
-
/* zwracam ewentualny wynik */
- return null;
- }
- };
-
/* start zadania do wykonania */
- worker.start();
- }
</code>
Materiały źródłowe
How to use Threads
Opis SwingWorker
Klasa SwingWorker do ściągnięcia
Dodaj komentarz
październik 29, 2008 @ 4:58 pm (ceny, luźne)
Tags: ceny, dziecko, niemowlak, szczepienia, Warszawa
Poniżej koszty szczepienia niemowlaka w różnych prywatnych placówkach w Warszawie.
Rotarix – szczepionka na rota wirusa
Infanrix Hexa – szczepionka skojarzona
|
medicover
- własne
szczepionki |
Medicover |
Lim – Mariot |
enel-med
Blue City
|
Babka
Medica |
| wizyta |
160 |
160 |
100 |
140 |
120 |
| rotarix |
346.87 |
360 |
400 |
340 |
350 |
| infanrix hexa |
209.16 |
242 |
225 |
180 |
200 |
|
|
|
|
|
|
| suma |
716.03 |
762 |
725 |
660 |
670 |
Dodaj komentarz
październik 22, 2008 @ 11:47 am (linux, tips)
This one-line command
- creates new folder – ‘new’ in current working folder
- process all files which contains numbers in file name
- number is substitute with missing zeros (maximum 3 zeros)
mkdir new; perl -e ‘foreach (<*>){ if (/(\d+)/) {; $name=sprintf “%03d“, $1; $f=$_; $f=~s/(\d+)/$name/; `cp “$_” “new/$f”`}}’
Dodaj komentarz
październik 15, 2008 @ 9:15 pm (weblogic)
java -cp ../../../server/lib/weblogic.jar utils.MulticastTest -P 7001 -A 239.192.0.0 -N srv1
-P port
-A multicast address
-N message send to other members
support patterns found:
https://support.bea.com/application_content/product_portlets/support_patterns/wls/MulticastErrorsPattern.html
Dodaj komentarz
październik 15, 2008 @ 9:01 pm (weblogic)
first change EmbeddedLDAP password (i.e. weblogic) from console.
ldapsearch -x -w weblogic -D “cn=Admin” -b “dc=test” -h localhost -p 7001 uid=weblogic
where -w weblogic – EmbeddedLDAP administrator password
-x – selects simple authentication method
-D “cn=Admin” – we are binding LDAP Administrator
-b dc=test – where ‘test’ – domainname
-h localhost – Weblogic’s listen address
-p 7001 – Welogic’s listen port
uid=weblogic – search filter – here we are looking for weblogic entry
full ldap search:
ldapsearch -x -w weblogic -D “cn=Admin” -b “dc=test” -h localhost -p 7001 *
Dodaj komentarz