ToolTip class
i’m creating a toolTip on a movieclip. so far i got the
text to load on the toolTip. i need some help on adding an image to
the right of the toolTip. what should I do ...
i'm thinking that an (img src="sampleimage.jpg" ) might work
but how do i change the tags so images are allowed .... anybody got
some ideas.
Similar Messages
-
Ok, I am in the bowels of TooTip Hell.
Scenario One:
I have a large window. On top of that is another window, a smaller window. So the user is using the top window. They want it to be the top window. They are happy on top.
Mouse cursor slips over to bottom window. They slip it back and are happy because they are still on top.
The mouse cursor slips again. This time when the cursor moves over the bottom window, it happens on a field with a tooltip. Before they can move the cursor back, the tooltip pops up, brings the bottom window to the top with it, and pushes the smaller window to the bottom. The user is unhappy.
Scenario Two:
I have a large window. The user hovers over a save button. They click Save. A dialog pops up confirming their data is safe. parent.getScene().getRoot().setEffect(new BoxBlur()); ias executed to obscur the parent window isnce this dialog is MODAL. The user selects OK, the dialog closes, and the parent window is readable again.
Happy with their experience, the user does some more work, they drag the mouse cursor to the Save button again. However, they are tired, so they are moving slower, and happen to linger a little too long on another control along the way. They trigger a tooltip, but before it is rendered, they make it to the save button and click it. The dialog box confirming their save pops up, and the parent is blurred. Then the tooltip of the parent pops up, pushes the modal dialog to the back. Now the user has a tooltip on a blurred window on top, and a modal dialog they can't proceed without somewhere in their deep stack of many open windows. They curse my name and cease to buy my product, because it is so unprofessional.
Suggestions? Guess I am looking for a way to insure a tooltip doesn't chnage the top to bottom order of my windows under ANY circumstances.One solution is to create your own tooltip skin (or node subclass) which does not use a popup window.
Make the parent of the Pane having the tooltip overlaid a StackPane, place your main content on the bottom of the stack and the tooltip content (when needed) layering over the base content when you hover.
Here is some sample code I used for something similar before (in this case it was a document modal dialog box for a web browser, but it should also work for a custom tooltip with some adjustment):
* Overlay a dialog on top of the webview.
* @param dialogNode the dialog to overlay on top of the view.
private void overlayView(Node dialogNode) {
// if the view is already overlaid we will just ignore this overlay call silently . . . todo probably not the best thing to do, but ok for now.
if (!(getView().getParent() instanceof BorderPane)) return;
// record the view's parent.
BorderPane viewParent = (BorderPane) getView().getParent();
// create an overlayPane layering the popup on top of the webview
StackPane overlayPane = new StackPane();
overlayPane.getChildren().addAll(getView(), new Group(dialogNode));
getView().setDisable(true);
// overlay the popup on the webview.
viewParent.setCenter(overlayPane);
private void removeViewOverlay() {
BorderPane viewParent = (BorderPane) getView().getParent().getParent();
viewParent.setCenter(getView());
}There may be some other solution if you want to use the standard Tooltip class with it's popup window, but I don't know what that is. -
Hi,
I'm creating a project for school in which they want me to populate a JComboBox with a movie list that I created in a text file.
I was thinking that I want to set a tooltip for each item (movie) and then modify it so that people can see a picture of the movie and a little summary.
What's the easiest way to do that?
Or maybe instead of a tooltip I could use different forms? Please, give me some ideas with some code too
Thanks
PS: This is the code I'm using to populate the JComboBox.
private void populateMovies()
String fileName = "src
Movies.txt",
movieList;
try
//File Reader
FileReader content = new FileReader(fileName);
BufferedReader inputFile = new BufferedReader(content);
movieList = inputFile.readLine();
while (movieList !=null)
movieSelectionJComboBox.addItem(movieList);
movieList = inputFile.readLine();
catch(FileNotFoundException exp)
exp.printStackTrace();
catch(IOException exp)
exp.printStackTrace();
Click to see GUI
http://i153.photobucket.com/albums/s224/andresmdiaz/AMDGUI.pngYou can set images in tooltips using HTML
String imageName = "file:image.jpg";
component.setToolTipText("<html>Here is an image <img src="+imageName+"></html>");
or for more flexibly but much more complexity, you can make your own tooltip class, here is an example of that:
http://www.java2s.com/Code/Java/Swing-JFC/ShowinganImageinaToolTip.htm
btw "image in tooltip java" came up with these results in the top 3. I suggest in the future you have a go, and post your failed attempt, if you fail that is. -
Needs Help In More Ways Then One!
Hi my name is James,
This is my situation. I have a map. This map is of the greater Denver area. I need it to do things, and its not cooperating.
I want it to be a single image on the web site, and when you roll over the image it "zooms in" like a rectangle magnifying glass over where the mouse is and follow the mouse, getting ride of the need for the scroll bar. So when you move the move to the borders of "box" it'll move in that direction but stop at the edges of the map.
I need to have a "button" for each city and when your over the city to bring up a banner saying something like "this is the city blah blah click for more info", and have it attached to a url to so when you click it it'll take the user to a dedicated page for THAT city.
I need to have the banner to be "flashy" and look "professional"
Sounds easy enough right? WRONG!!!
I have had issue after issue with this thing, you have no idea! I need it done by the end of March and I've been working on it sence the beginning of January. So here are the problems im having
I have no idea how to incorporate the "zoom" feature or what kind of command to use. I've tried the "scale" one and it didn’t work right. I have NO experience in actionscript what so ever. I tried using HTML and it was nice but not "flashy" enough.
I cant get the banner to work right, I have the buttons set up, I used the pen tool to make sure the area is exactly covered so that there wasn't any gaps when your mouse rolls over it. At first I used the oval tool and just made bubbles over the general areas and had massive gaps in between cities and some ovals interloped because they’re so close together. So I figured that issue out. Now I have the buttons and I have each button have an "over" and a "hit" frame. The "over" one for the banner and the "hit" one for the url. I think I have that figured out but I don’t know how to put the code in for just the "hit" frame to take the user to the url and I don’t know if I have to make a banner for EVERY city or if there’s a short cut I could use. And anyways I don’t want to work on that till I get issue #1 fixed.
Just so you know what im working with here is the image im working with.
So if anyone could walk me through it per say or just tell me the available commands to get the "zoom" to work I would be your best friend forever. haha
Thanks in advance,
JamesCode for Magnifying glass in AS3:
http://www.flashandmath.com/intermediate/magglass/index.html
Code for Tooltip class in as3:
http://hairydoodle.blogspot.com/2009/04/as3-tooltip.html
change this line of the class:
_tf.text = tip;
to
_tf.htmlText = tip;
and then in your main.fla say sth like:
//when you click on Denver a Browser will open the URL
var toolTip:ToolTip = new ToolTip( 'This is <a href="http://www.denver.com">Denver<\> ); -
Hi All, hope you can help,
I want to hide the last column of my table, but still access its data. Inside the last column certain information is present, the cell tooltips.
In my extended JTable class my method getToolTipText looks like this:
// implement table cell tool tip.
public String getToolTipText(MouseEvent e) {
String tip = null;
Point p = e.getPoint();
int rowIndex = rowAtPoint(p);
int colIndex = columnAtPoint(p);
int realColumnIndex = convertColumnIndexToModel(colIndex);
if(rowIndex>=0 && rowIndex<=lastRow) {
if(realColumnIndex==0) {
MiniModel mml = (MiniModel)getValueAt(rowIndex, 5); // exception here
tip = "<html>" + replaceCRLFtoBR(mml.getComment()) + "</html>"; // replaceCRLFtoBR = custom method to replace \n by <br>
} else {
tip = columnTips[realColumnIndex]; // constant
return tip;
}As you can see at column 5 an object MiniModel is present containing the tooltip for column 0.
When I use the method removeColumn on column 5 on my extended JTable variable, I get an java.lang.ArrayIndexOutOfBoundsException at the marked position and in more detail on getValueAt.
As I read everywhere the actual data is not removed (only from the view) I wonder what I'm doing wrong...
MichielThanks for the advice, I will prepare better next time, here is my sscce :
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
public class TableHide extends JFrame {
private static final String[] colNames = {"Column 1", "Column 2", "Column 3"};
private static final String[] colHeadTips = {"Header tip 1", "Header tip 2", "Header tip 3"};
private ExtTableModel myTableModel;
private ExtTable myTable;
private JScrollPane myScrollPane;
private int lastRow = 0;
// for example
private MiniModel mmlRow1 = new MiniModel(1, "cell comment");
private MiniModel mmlRow2 = new MiniModel(2, "other cell comment");
// constructor
public TableHide() {
this.setTitle("Table column hide test");
this.setResizable(true);
this.setLayout(new BorderLayout());
// build table containing all extended Model's id and name
myTableModel = new ExtTableModel(null, colNames);
myTable = new ExtTable(myTableModel);
myTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
myTable.setPreferredScrollableViewportSize(new Dimension(500, 130));
myTable.setFillsViewportHeight(true);
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.getTableHeader().setReorderingAllowed(false);
myScrollPane = new JScrollPane(myTable);
this.add(myScrollPane, BorderLayout.CENTER);
// add some rows, in real application this is more complex
myTableModel.insertRow(0, new Object[]{ "Basic string", new Boolean(false), mmlRow1 }); lastRow++;
myTableModel.insertRow(0, new Object[]{ "Other string", new Boolean(true) , mmlRow2 }); lastRow++;
myTable.setAutoCreateRowSorter(true);
myTable.getRowSorter().toggleSortOrder(0);
// this causes the exception
myTable.removeColumn(myTable.getColumnModel().getColumn(2));
this.setSize(new Dimension(500,200));
// inner class to provide an own table model for the extended Models showed on screen. used for booleans
class ExtTableModel extends DefaultTableModel {
public ExtTableModel(Object[][] tableData, String[] columnNames) {
super(tableData, columnNames);
public boolean isCellEditable(int row, int col) {
return false;
public Class getColumnClass(int column){
Object value=this.getValueAt(0,column);
return (value==null?Object.class:value.getClass());
// inner class to privide column header tooltips and cell tooltips
class ExtTable extends JTable {
public ExtTable(ExtTableModel extModel) {
super(extModel);
// implement table cell tool tip.
public String getToolTipText(MouseEvent e) {
String tip = null;
Point p = e.getPoint();
int rowIndex = rowAtPoint(p);
int colIndex = columnAtPoint(p);
int realColumnIndex = convertColumnIndexToModel(colIndex);
if(rowIndex>=0 && rowIndex<=lastRow) {
if(realColumnIndex==0) {
MiniModel mml = (MiniModel)getValueAt(rowIndex, 2);
tip = mml.getMml_comment();
} else {
tip = "Some other tooltip function";
return tip;
// implement table header tool tip.
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
public String getToolTipText(MouseEvent e) {
Point p = e.getPoint();
int index = columnModel.getColumnIndexAtX(p.x);
int realIndex = columnModel.getColumn(index).getModelIndex();
return colHeadTips[realIndex];
// simplified class for usage inside a cell
public class MiniModel {
private int mml_id;
private String mml_comment;
public MiniModel(int mml_id, String mml_comment) {
this.mml_id = mml_id;
this.mml_comment = mml_comment;
public String getMml_comment() {
return mml_comment;
public String toString() {
return Integer.toString(mml_id); // called when object is displayed
public static void main(String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
ex.printStackTrace();
new TableHide().setVisible(true);
}When you show the last column the program works fine. Goal is to have the last column available since it contains extra information about the row, but not to show it. -
Hey guys I need help making this countdown work. Im only getting this....
Im using the Edson Hilios countdown, but don't know how to set the countdown time....
jquery.countdown :
* jQuery The Final Countdown plugin v1.0.0 beta
* http://github.com/hilios/jquery.countdown
* Copyright (c) 2011 Edson Hilios
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(function($) {
$.fn.countdown = function(toDate, callback) {
var handlers = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'daysLeft'];
function delegate(scope, method) {
return function() { return method.call(scope) }
return this.each(function() {
// Convert
if(!(toDate instanceof Date)) {
if(String(toDate).match(/^[0-9]*$/)) {
toDate = new Date(toDate);
} else if( toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{ 2})/) ||
toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{ 2})/)
toDate = new Date(toDate);
} else if(toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})/) ||
toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})/)
toDate = new Date(toDate)
} else {
throw new Error("Doesn't seen to be a valid date object or string")
var $this = $(this),
values = {},
lasting = {},
interval = $this.data('countdownInterval'),
currentDate = new Date(),
secondsLeft = Math.floor((toDate.valueOf() - currentDate.valueOf()) / 1000);
function triggerEvents() {
secondsLeft--;
if(secondsLeft < 0) {
secondsLeft = 0;
lasting = {
seconds : secondsLeft % 60,
minutes : Math.floor(secondsLeft / 60) % 60,
hours : Math.floor(secondsLeft / 60 / 60) % 24,
days : Math.floor(secondsLeft / 60 / 60 / 24),
weeks : Math.floor(secondsLeft / 60 / 60 / 24 / 7),
daysLeft: Math.floor(secondsLeft / 60 / 60 / 24) % 7
for(var i=0; i<handlers.length; i++) {
var eventName = handlers[i];
if(values[eventName] != lasting[eventName]) {
values[eventName] = lasting[eventName];
dispatchEvent(eventName);
if(secondsLeft == 0) {
stop();
dispatchEvent('finished');
triggerEvents();
function dispatchEvent(eventName) {
var event = $.Event(eventName);
event.date = new Date(new Date().valueOf() + secondsLeft);
event.value = values[eventName] || "0";
event.toDate = toDate;
event.lasting = lasting;
switch(eventName) {
case "seconds":
case "minutes":
case "hours":
event.value = event.value < 10 ? '0'+event.value.toString() : event.value.toString();
break;
default:
if(event.value) {
event.value = event.value.toString();
break;
callback.call($this, event);
/*$this.bind('remove', function() {
stop(); // If the selector is removed clear the interval for memory sake!
dispatchEvent('removed');
function stop() {
clearInterval(interval);
function start() {
$this.data('countdownInterval', setInterval(delegate($this, triggerEvents), 1000));
interval = $this.data('countdownInterval');
if(interval) stop();
start();
// Wrap the remove method to trigger an event when called
var removeEvent = new $.Event('remove'),
removeFunction = $.fn.remove;
/*$.fn.remove = function() {
$(this).trigger(removeEvent);
return removeFunction.apply(this, arguments);
})(jQuery);
index.html :
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nero-Hosting Updating</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- Custom font from Google Web Fonts -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
<!-- Social font -->
<link href="css/social-font.css" rel="stylesheet">
<!-- Template stylesheet -->
<link href="css/metronome.css" rel="stylesheet">
</head>
<body>
<div class="container">
<!-- Header -->
<h1 class="header section">Nero-Hosting</h1>
<!-- /Header -->
<!-- Description -->
<p class="description section">We are just updating our website and making lots and lots of changes! Check Back Soon!</p>
<!-- /Description -->
<!-- Countdown -->
<div id="countdown" class="countdown section">
<div class="countdown-item">
<div class="countdown-label">Days</div>
<div class="countdown-number red" id="countdown-days">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
<div class="countdown-item">
<div class="countdown-label">Hours</div>
<div class="countdown-number yellow" id="countdown-hours">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
<div class="countdown-item">
<div class="countdown-label">Minutes</div>
<div class="countdown-number blue" id="countdown-minutes">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
<div class="countdown-item">
<div class="countdown-label">Seconds</div>
<div class="countdown-number green" id="countdown-seconds">
<div class="countdown-number-side countdown-number-back"></div>
<div class="countdown-number-side countdown-number-front"></div>
</div>
</div>
</div>
<!-- /Countdown -->
<!-- Social links -->
<div class="social-links">
<a href="https://twitter.com/Nero_Hosting" class="icon-twitter-alt red"></a>
</div>
<!-- /Social links -->
</div>
<!-- Scripts -->
<script src="../ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.9.1.min.js"><\/script>')</script>
<script src="js/jquery.countdown.js"></script>
<script src="js/placeholders.min.js"></script>
<script src="js/metronome.js"></script>
<audio loop="" autoplay="">
<source src="http://www.goodymusic.it/public/allegati/audio/51823_11820913007504706977.mp3" type="audio/mpeg"></audio>
</body>
</html>
metrome design :
========================================================================================== ==============================
Metronome - Coming Soon Page
v 1.0, 13 May 2013
by Alex Shnayder
========================================================================================== ==============================
Main javascript file
$(document).ready(function() {
var config;
$.getJSON('config.json').done(function(data) {
config = data;
Countdown
========================================================================================== ========*/
var date = new Date(config.countdown.year,
config.countdown.month - 1,
config.countdown.day,
config.countdown.hour,
config.countdown.minute,
config.countdown.second),
$countdown = $('#countdown'),
$countdown_numbers = {
days: $('#countdown-days'),
hours: $('#countdown-hours'),
minutes: $('#countdown-minutes'),
seconds: $('#countdown-seconds')
tab_focused = true;
$(window).on('focus', function() {
tab_focused = true;
$(window).on('blur', function() {
tab_focused = false;
$.each($countdown_numbers, function() {
var $this = $(this);
$this.data({
angle: 0,
sides: {
current: $('.countdown-number-front', $this),
other: $('.countdown-number-back', $this)
current_side: 1
$countdown.countdown(date, function(event) {
if (event.type == 'finished') {
$countdown.hide();
} else if (tab_focused) {
var $tile,
$current_side,
$other_side,
angle,
timer;
$tile = $countdown_numbers[event.type];
if (!$tile) {
return;
$current_side = $tile.data('sides').current;
$other_side = $tile.data('sides').other;
angle = $tile.data('angle') + 180;
$tile.css('transform', 'rotateY(' + angle + 'deg)').data('angle', angle);
$other_side.text(event.value);
timer = setTimeout(function() {
$current_side.hide();
$other_side.show();
$tile.data('sides', {
current: $other_side,
other: $current_side
clearTimeout(timer);
}, 250);
Subscription form
========================================================================================== ========*/
var messages = config.subscription_form_tooltips,
error = false,
$form = $('#subscription-form'),
$email = $('#subscription-email'),
$button = $('#subscription-submit'),
$tooltip;
function renderTooltip(type, message) {
var offset;
if (!$tooltip) {
$tooltip = $('<p id="subscription-tooltip" class="subscription-tooltip"></p>').appendTo($form);
if (type == 'success') {
$tooltip.removeClass('error').addClass('success');
} else {
$tooltip.removeClass('success').addClass('error');
$tooltip.text(message).fadeTo(0, 0);
offset = $tooltip.outerWidth() / 2;
$tooltip.css('margin-left', -offset).animate({top: '100%'}, 200).dequeue().fadeTo(200, 1);
function hideTooltip() {
if ($tooltip) {
$tooltip.animate({top: '120%'}, 200).dequeue().fadeTo(100, 0);
function changeFormState(type, message) {
$email.removeClass('success error');
if (type == 'normal') {
hideTooltip();
} else {
renderTooltip(type, message);
$email.addClass(type);
$form.submit(function(event) {
event.preventDefault();
var email = $email.val();
if (email.length == 0) {
changeFormState('error', messages['empty_email']);
} else {
$.post('./admin/index.php?page=subscribe', {
'email': email,
'ajax': 1
}, function(data) {
if (data.status == 'success') {
changeFormState('success', messages['success']);
} else {
switch(data.error) {
case 'empty_email':
case 'invalid_email':
case 'already_subscribed':
changeFormState('error', messages[data.error]);
break;
default:
changeFormState('error', messages['default_error'])
break;
}, 'json');
// Remove tooltip on text change
$email.on('change focus click keydown', function() {
if ($email.val().length > 0) {
changeFormState('normal');
============================================================
If you need more info or files just tell me...Read the documentation:
http://hilios.github.io/jQuery.countdown/
Nancy O. -
Scrollbars and awt.List
Hello,
I'm a first year student form the Netherlands in software design. And as of this semester I'm getting Java (finally a new language to learn!). Everything has gone very smoothly, I was hoping of more of a challenge trying to learn it, but it goes very easily (maybe I shouldn't have programmed in C++ for 3 years :P).
Though now I'm having a slight problem with my code. v _ v '
My project has to be competly in awt widget's, and I thought I'd do something more than required (it would seem that my teachers expect me to ^ _ ^).
In this list I'm required to use a fixed width font to "simulate" 2 panels (almost similar to the TableList in Swing) with a pipe ( | ) character as a line. It means that I need to cut off words that cross the boundry.
The above (and the rest of the assignment) works perfectly (and I've done the actual required part in less than 30 minutes), but now I've come to want to add tool tips to all the elements.
I've made a tooltip class (it works btw), but I need to get the item in the list my mouse is hovering over.
I believe a row is 20 pixels high (or something like that), so I divide the y value (of the local mouse position) by 20 and use the integer part as the index.
And here comes the problem.
When the list scrolls then the method I described above won't work anymore.
I think that my method is (atleast) similar as to what other programs do, save that it adds the scroll info as well.
Now here's my real problem. I can't (or don't know how) to get the scrollbar info from the list. I know there's a handy function is Swing, but I'm only allowed to use awt.
I've also read that the scrollbars are part of the peer's (native to the OS) so I can't access them.
So my true question is, what (if any) event should I listen to, to get scroll movements (not mouse wheel scrolling)?
And if there isn't any way to listen to the events, then do you have any idea how to tackle this problem?
Thank you for your time,
MLeoDaalderShowing me your misbehaving output is not helpful.
I have successfully implemented what you are attempting, using Swing which I understand you cannot use but it should work the same way using AWT.
My main class extends JFrame (you would extend Frame) and implements MouseMotionListener. The mouseMoved(MouseEvent evt) method in the main class updates the tool tip, based on the evt.getX() and evt.getY().
I have a class (call it LCanvas) that extends JPanel (you would extend Panel) . The class adds a MouseMotionListener and has a paint(Graphics g) method that records the borders of each line that gets painted by g.drawString(String s, int x, int y). (Some of the painted lines may be outside of the displayed area.)
When I construct LCanvas, I pass it the JFrame (you would use Frame) of the main class. So my contructor looks like:
public LCanvas(JFrame f) {
addMouseMotionListener((MouseMotionListener) f);
Back in main(String [ ] args), I set up my scrollable window as:
MainClass f = new MainClass();
LCanvas lc = new LCanvas(f);
JScrollPane sp = new JScrollPane(lc);
content_pane.add(sp);
I don't know how you are trying to implement this but you should be able to compare it to my implementation that works and, since you are such a clever guy, figure out what's going wrong. -
How to display Image by using Array?
Hi all, I know to how to display the image in MXML by using
AS 3.0
like this:
<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
width="100" height="80" borderStyle="solid">
<mx:Script>
<![CDATA[
[Embed(source="logo.gif")]
[Bindable]
public var imgCls:Class;
]]>
</mx:Script>
<mx:Image source="{imgCls}"/>
<!--OR-->
<mx:Image source="@Embed('assets/Nokia_6630.png')"/>
</mx:Application>
But the thing is I am building a list for display the images,
the values is come from the Array. I am trying a different way for
display it but no working, here is my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public var PICTURE_ARRAY:Array = [{label:"FileA",
icon:"@Embed('upload/myjpg.jpg')"},
{label:"FileC", icon:"@Embed('upload/myjpg.jpg')"},
{label:"FileB", icon:"@Embed('upload/myjpg.jpg')"}]
]]>
</mx:Script>
<mx:Tile id="pictureSelection" height="180" width="500"
borderStyle="solid">
<mx:Repeater id="picRP"
dataProvider="{PICTURE_ARRAY}">
<mx:VBox horizontalAlign="center" verticalAlign="middle"
verticalGap="0" borderStyle="none" width="100" height="100">
<mx:Image width="80" height="80"
source="{picRP.currentItem.icon}"
toolTip="{picRP.currentItem.icon}"/>
<!--
I also tryed this as well:
set the icon value as picture location like: "A.jpg" or
"B.jpg"
then
<mx:Image width="80" height="80"
source="@Embed('upload/{picRP.currentItem.icon}')" />
-->
<mx:Label text="{picRP.currentItem.label}" width="100"
textAlign="center"/>
</mx:VBox>
</mx:Repeater>
</mx:Tile>
</mx:Application>
Can anyone tell how to display the array value into Image
tag? ThanksIn your data you have this:
{label:"FileC", icon:"@Embed('upload/myjpg.jpg')"},
change it to this:
{label:"FileC", icon:"upload/myjpg.jpg"}, // this is just the
filename, not embedded
In your Repeater you have this Image tag:
<mx:Image width="80" height="80"
source="{picRP.currentItem.icon}"
toolTip="{picRP.currentItem.icon}"/>
which is fine, except for the toolTip. The toolTip uses a
string, not an image. If you want to show an image in the toolTip,
you'll need to write your own toolTip class.
Now the source property of the image will be given the URL to
the image which will then be requested from the server and
downloaded at runtime - it is not embedded.
If you need to embed the images, then your dataProvider
should have the variable name associated with the embedded
image. -
How do I reference a javascript file in a jar file
Hi all,
I'm trying to reference a javascript file, which is contained in a jar file, from my html page.
So far I have had no success :
I saw a reference to the SCRIPT tag attribute ARCHIVE.
Does this work for Internet Explorer 5?
I tried using <SCRIPT ARCHIVE="path_to_jar"
SRC="javascript.js"/>
but this didn't work.
Does anyone have any suggestions?
Thanks for any help you can give,
PaulHere is an example with an applet tag (this applet doesn't require a Java plugin):
HTML file
========
<script src="Dialog.js" archive="Dialog.jar"></script>
<APPLET CODE = "myDialog.class" CODEBASE = "." ARCHIVE = "Dialog.jar" WIDTH = 280 HEIGHT = 80 NAME = "DIA" MAYSCRIPT = true>
</APPLET>
Contents of Dialog.jar file
====================
META-INF/
META-INF/MANIFEST.MF
dialog.class
matrix$1.class
matrix.class
myCanvas.class
myDialog.class
myPanel.class
PicButton.class
resource.class
ToolTip$MAdapter.class
ToolTip.class
Dialog.js
This combination works for me on NN4+ and IE5_.
V.V. -
How do I reference a .js file in .html on iweb to be viewed online!
OK,
I have a B-Ball Stat sheet I am trying to post on my website. I create the stats in excel and export the sheet to .html from there I copy the .html code and paste it in a HTML Snippet. This works GREAT!
NOW
I am trying to link this code to a .js file so that I am able to sort the stats by each topic. When I reference the .js file in the original .html file, the sorting works fine offline. I just need to reference the .js file so the website html can see it.
Any help would be appreciated as I am new to .html codeHere is an example with an applet tag (this applet doesn't require a Java plugin):
HTML file
========
<script src="Dialog.js" archive="Dialog.jar"></script>
<APPLET CODE = "myDialog.class" CODEBASE = "." ARCHIVE = "Dialog.jar" WIDTH = 280 HEIGHT = 80 NAME = "DIA" MAYSCRIPT = true>
</APPLET>
Contents of Dialog.jar file
====================
META-INF/
META-INF/MANIFEST.MF
dialog.class
matrix$1.class
matrix.class
myCanvas.class
myDialog.class
myPanel.class
PicButton.class
resource.class
ToolTip$MAdapter.class
ToolTip.class
Dialog.js
This combination works for me on NN4+ and IE5_.
V.V. -
Hi Guys, I need help finding the right piece of Javascript code to amend in the Adora template to slow the slides down to flip every 5 or 6 seconds (5000 to 6000 milliseconds) as opposed to what I can only assume is currently 3 secs (3000 milliseconds).
I've used the default BizCatalyst file manager to "edit" line 624 of jquery.anythingslider.js from 3000 milliseconds to 6000 milliseconds with no affect.
What am I missing here? Is this not the right line? Does "editing" via BizCatalyst's File Manager not work? I'll admit it's not the most advanced File Manager around (not by a long shot) but surely it should work as it would suggest when you "edit", amend, and "save"?
I've hunted in these forums and within the other Javascript files and am having no luck.
I'm assuming the Javascript file in question is jquery.anythingslider.js. I've been through the rest of them and they don't appear to have anything to do with the slideshow. jquery.nivo.slider.pack.js might have something to do with it but... MAN... that coding is a mess. What were youu guys thinking using a Script that messy within a template that people are going to want to customise? Lift your game please - you are Adobe, not some rank amateurs. Finding a piece of code in there is like finding a needle in 100 haystacks.
Des McKenzieThanks Pat,
There is indeed a jquery.anythingslider.js file within the "JS" folder but I've tried chamging the delay from 3000 to 6000 even to 20000 but it makes no diff. Also it seems to sit for a disproportionate length of time on first load before the first scroll.
Code from jquery.anythingslider.js is:
AnythingSlider v1.5.7.3
By Chris Coyier: http://css-tricks.com
with major improvements by Doug Neiner: http://pixelgraphics.us/
based on work by Remy Sharp: http://jqueryfordesigners.com/
crazy mods by Rob Garrison (aka Mottie): https://github.com/ProLoser/AnythingSlider
To use the navigationFormatter function, you must have a function that
accepts two paramaters, and returns a string of HTML text.
index = integer index (1 based);
panel = jQuery wrapped LI item this tab references
@return = Must return a string of HTML/Text
navigationFormatter: function(index, panel){
return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index
(function($) {
$.anythingSlider = function(el, options) {
// To avoid scope issues, use 'base' instead of 'this'
// to reference this class from internal events and functions.
var base = this;
// Wraps the ul in the necessary divs and then gives Access to jQuery element
base.$el = $(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');
// Add a reverse reference to the DOM object
base.$el.data("AnythingSlider", base);
base.init = function(){
base.options = $.extend({}, $.anythingSlider.defaults, options);
if ($.isFunction(base.options.onBeforeInitialize)) { base.$el.bind('before_initialize', base.options.onBeforeInitialize); }
base.$el.trigger('before_initialize', base);
// Cache existing DOM elements for later
// base.$el = original ul
// for wrap - get parent() then closest in case the ul has "anythingSlider" class
base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + base.options.theme);
base.$window = base.$el.closest('div.anythingWindow');
base.$controls = $('<div class="anythingControls"></div>').appendTo( (base.options.appendControlsTo !== null && $(base.options.appendControlsTo).length) ? $(base.options.appendControlsTo) : base.$wrapper); // change so this works in jQuery 1.3.2
base.win = window;
base.$win = $(base.win);
base.$nav = $('<ul class="thumbNav" />').appendTo(base.$controls);
// Set up a few defaults & get details
base.timer = null; // slideshow timer (setInterval) container
base.flag = false; // event flag to prevent multiple calls (used in control click/focusin)
base.playing = false; // slideshow state
base.hovered = false; // actively hovering over the slider
base.panelSize = []; // will contain dimensions and left position of each panel
base.currentPage = base.options.startPanel;
base.adjustLimit = (base.options.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes
if (base.options.playRtl) { base.$wrapper.addClass('rtl'); }
// save some options
base.original = [ base.options.autoPlay, base.options.buildNavigation, base.options.buildArrows];
base.updateSlider();
base.$currentPage = base.$items.eq(base.currentPage);
base.$lastPage = base.$currentPage;
// Get index (run time) of this slider on the page
base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1;
base.regex = new RegExp('panel' + base.runTimes + '-(\\d+)', 'i'); // hash tag regex
// Make sure easing function exists.
if (!$.isFunction($.easing[base.options.easing])) { base.options.easing = "swing"; }
// Add theme stylesheet, if it isn't already loaded
if (base.options.theme !== 'default' && !$('link[href*=' + base.options.theme + ']').length){
$('body').append('<link rel="stylesheet" href="' + base.options.themeDirectory.replace(/\{themeName\}/g, base.options.theme) + '" type="text/css" />');
// If pauseOnHover then add hover effects
if (base.options.pauseOnHover) {
base.$wrapper.hover(function() {
if (base.playing) {
base.$el.trigger('slideshow_paused', base);
base.clearTimer(true);
}, function() {
if (base.playing) {
base.$el.trigger('slideshow_unpaused', base);
base.startStop(base.playing, true);
// If a hash can not be used to trigger the plugin, then go to start panel
var startPanel = (base.options.hashTags) ? base.gotoHash() || base.options.startPanel : base.options.startPanel;
base.setCurrentPage(startPanel, false); // added to trigger events for FX code
// Hide/Show navigation & play/stop controls
base.slideControls(false);
base.$wrapper.bind('mouseenter mouseleave', function(e){
base.hovered = (e.type === "mouseenter") ? true : false;
base.slideControls( base.hovered, false );
// Add keyboard navigation
if (base.options.enableKeyboard) {
$(document).keyup(function(e){
if (base.$wrapper.is('.activeSlider')) {
switch (e.which) {
case 39: // right arrow
base.goForward();
break;
case 37: //left arrow
base.goBack();
break;
// Binds events
var triggers = "slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");
$.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i,o){
if ($.isFunction(base.options[o])){
base.$el.bind(triggers[i], base.options[o]);
if ($.isFunction(base.options.onSlideComplete)){
// Added setTimeout (zero time) to ensure animation is complete... see this bug report: http://bugs.jquery.com/ticket/7157
base.$el.bind('slide_complete', function(){
setTimeout(function(){ base.options.onSlideComplete(base); }, 0);
base.$el.trigger('initialized', base);
// called during initialization & to update the slider if a panel is added or deleted
base.updateSlider = function(){
// needed for updating the slider
base.$el.find('li.cloned').remove();
base.$nav.empty();
base.$items = base.$el.find('> li');
base.pages = base.$items.length;
// Set the dimensions of each panel
if (base.options.resizeContents) {
if (base.options.width) { base.$wrapper.add(base.$items).css('width', base.options.width); }
if (base.options.height) { base.$wrapper.add(base.$items).css('height', base.options.height); }
// Remove navigation & player if there is only one page
if (base.pages === 1) {
base.options.autoPlay = false;
base.options.buildNavigation = false;
base.options.buildArrows = false;
base.$controls.hide();
base.$nav.hide();
if (base.$forward) { base.$forward.add(base.$back).hide(); }
} else {
base.options.autoPlay = base.original[0];
base.options.buildNavigation = base.original[1];
base.options.buildArrows = base.original[2];
base.$controls.show();
base.$nav.show();
if (base.$forward) { base.$forward.add(base.$back).show(); }
// Build navigation tabs
base.buildNavigation();
// If autoPlay functionality is included, then initialize the settings
if (base.options.autoPlay) {
base.playing = !base.options.startStopped; // Sets the playing variable to false if startStopped is true
base.buildAutoPlay();
// Build forwards/backwards buttons
if (base.options.buildArrows) { base.buildNextBackButtons(); }
// Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
// This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID
base.$el.prepend( (base.options.infiniteSlides) ? base.$items.filter(':last').clone().addClass('cloned').removeAttr('id') : $('<li class="cloned" />') );
base.$el.append( (base.options.infiniteSlides) ? base.$items.filter(':first').clone().addClass('cloned').removeAttr('id') : $('<li class="cloned" />') );
base.$el.find('li.cloned').each(function(){
// replace <a> with <span> in cloned panels to prevent shifting the panels by tabbing - modified so this will work with jQuery 1.3.2
$(this).html( $(this).html().replace(/<a/gi, '<span').replace(/\/a>/gi, '/span>') );
$(this).find('[id]').removeAttr('id');
// We just added two items, time to re-cache the list, then get the dimensions of each panel
base.$items = base.$el.find('> li').addClass('panel');
base.setDimensions();
if (!base.options.resizeContents) { base.$win.load(function(){ base.setDimensions(); }); } // set dimensions after all images load
if (base.currentPage > base.pages) {
base.currentPage = base.pages;
base.setCurrentPage(base.pages, false);
base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection
base.hasEmb = base.$items.find('embed[src*=youtube]').length; // embedded youtube objects exist in the slider
base.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && $.isFunction(swfobject.embedSWF)) ? true : false; // is swfobject loaded?
// Initialize YouTube javascript api, if YouTube video is present
if (base.hasEmb && base.hasSwfo) {
base.$items.find('embed[src*=youtube]').each(function(i){
// Older IE doesn't have an object - just make sure we are wrapping the correct element
var $tar = ($(this).parent()[0].tagName === "OBJECT") ? $(this).parent() : $(this);
$tar.wrap('<div id="ytvideo' + i + '"></div>');
// use SWFObject if it exists, it replaces the wrapper with the object/embed
swfobject.embedSWF($(this).attr('src') + '&enablejsapi=1&version=3&playerapiid=ytvideo' + i, 'ytvideo' + i,
$tar.attr('width'), $tar.attr('height'), '10', null, null,
{ allowScriptAccess: "always", wmode : base.options.addWmodeToObject, allowfullscreen : true },
{ 'class' : $tar.attr('class'), 'style' : $tar.attr('style') },
function(){ if (i >= base.hasEmb - 1) { base.$el.trigger('swf_completed', base); } } // swf callback
// Fix tabbing through the page
base.$items.find('a').unbind('focus').bind('focus', function(e){
base.$items.find('.focusedLink').removeClass('focusedLink');
$(this).addClass('focusedLink');
var panel = $(this).closest('.panel');
if (!panel.is('.activePage')) {
base.gotoPage(base.$items.index(panel));
e.preventDefault();
// Creates the numbered navigation links
base.buildNavigation = function() {
if (base.options.buildNavigation && (base.pages > 1)) {
base.$items.filter(':not(.cloned)').each(function(i,el) {
var index = i + 1,
klass = ((index === 1) ? 'first' : '') + ((index === base.pages) ? 'last' : ''),
$a = $('<a href="#"></a>').addClass('panel' + index).wrap('<li class=" + klass + " />');
base.$nav.append($a.parent()); // use $a.parent() so IE will add <li> instead of only the <a> to the <ul>
// If a formatter function is present, use it
if ($.isFunction(base.options.navigationFormatter)) {
var tmp = base.options.navigationFormatter(index, $(this));
$a.html(tmp);
// Add formatting to title attribute if text is hidden
if (parseInt($a.css('text-indent'),10) < 0) { $a.addClass(base.options.tooltipClass).attr('title', tmp); }
} else {
$a.text(index);
$a.bind(base.options.clickControls, function(e) {
if (!base.flag && base.options.enableNavigation) {
// prevent running functions twice (once for click, second time for focusin)
base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
base.gotoPage(index);
if (base.options.hashTags) { base.setHash(index); }
e.preventDefault();
// Creates the Forward/Backward buttons
base.buildNextBackButtons = function() {
if (base.$forward) { return; }
base.$forward = $('<span class="arrow forward"><a href="#">' + base.options.forwardText + '</a></span>');
base.$back = $('<span class="arrow back"><a href="#">' + base.options.backText + '</a></span>');
// Bind to the forward and back buttons
base.$back.bind(base.options.clickArrows, function(e) {
base.goBack();
e.preventDefault();
base.$forward.bind(base.options.clickArrows, function(e) {
base.goForward();
e.preventDefault();
// using tab to get to arrow links will show they have focus (outline is disabled in css)
base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){
$(this).toggleClass('hover');
// Append elements to page
base.$wrapper.prepend(base.$forward).prepend(base.$back);
base.$arrowWidth = base.$forward.width();
// Creates the Start/Stop button
base.buildAutoPlay = function(){
if (base.$startStop) { return; }
base.$startStop = $("<a href='#' class='start-stop'></a>").html(base.playing ? base.options.stopText : base.options.startText);
base.$controls.prepend(base.$startStop);
base.$startStop
.bind(base.options.clickSlideshow, function(e) {
if (base.options.enablePlay) {
base.startStop(!base.playing);
if (base.playing) {
if (base.options.playRtl) {
base.goBack(true);
} else {
base.goForward(true);
e.preventDefault();
// show button has focus while tabbing
.bind('focusin focusout',function(){
$(this).toggleClass('hover');
// Use the same setting, but trigger the start;
base.startStop(base.playing);
// Set panel dimensions to either resize content or adjust panel to content
base.setDimensions = function(){
var w, h, c, cw, dw, leftEdge = 0, bww = base.$window.width(), winw = base.$win.width();
base.$items.each(function(i){
c = $(this).children('*');
if (base.options.resizeContents){
// get viewport width & height from options (if set), or css
w = parseInt(base.options.width,10) || bww;
h = parseInt(base.options.height,10) || base.$window.height();
// resize panel
$(this).css({ width: w, height: h });
// resize panel contents, if solitary (wrapped content or solitary image)
if (c.length === 1){
c.css({ width: '100%', height: '100%' });
if (c[0].tagName === "OBJECT") { c.find('embed').andSelf().attr({ width: '100%', height: '100%' }); }
} else {
// get panel width & height and save it
w = $(this).width(); // if not defined, it will return the width of the ul parent
dw = (w >= winw) ? true : false; // width defined from css?
if (c.length === 1 && dw){
cw = (c.width() >= winw) ? bww : c.width(); // get width of solitary child
$(this).css('width', cw); // set width of panel
c.css('max-width', cw); // set max width for all children
w = cw;
w = (dw) ? base.options.width || bww : w;
$(this).css('width', w);
h = $(this).outerHeight(); // get height after setting width
$(this).css('height', h);
base.panelSize[i] = [w,h,leftEdge];
leftEdge += w;
// Set total width of slider, but don't go beyond the set max overall width (limited by Opera)
base.$el.css('width', (leftEdge < base.options.maxOverallWidth) ? leftEdge : base.options.maxOverallWidth);
base.gotoPage = function(page, autoplay, callback) {
if (base.pages === 1) { return; }
base.$lastPage = base.$items.eq(base.currentPage);
if (typeof(page) !== "number") {
page = base.options.startPage;
base.setCurrentPage(base.options.startPage);
// pause YouTube videos before scrolling or prevent change if playing
if (base.hasEmb && base.checkVideo(base.playing)) { return; }
if (page > base.pages + 1 - base.adjustLimit) { page = (!base.options.infiniteSlides && !base.options.stopAtEnd) ? 1 : base.pages; }
if (page < base.adjustLimit ) { page = (!base.options.infiniteSlides && !base.options.stopAtEnd) ? base.pages : 1; }
base.$currentPage = base.$items.eq(page);
base.currentPage = page; // ensure that event has correct target page
base.$el.trigger('slide_init', base);
base.slideControls(true, false);
// When autoplay isn't passed, we stop the timer
if (autoplay !== true) { autoplay = false; }
// Stop the slider when we reach the last page, if the option stopAtEnd is set to true
if (!autoplay || (base.options.stopAtEnd && page === base.pages)) { base.startStop(false); }
base.$el.trigger('slide_begin', base);
// resize slider if content size varies
if (!base.options.resizeContents) {
// animating the wrapper resize before the window prevents flickering in Firefox
base.$wrapper.filter(':not(:animated)').animate(
{ width: base.panelSize[page][0], height: base.panelSize[page][1] },
{ queue: false, duration: base.options.animationTime, easing: base.options.easing }
// Animate Slider
base.$window.filter(':not(:animated)').animate(
{ scrollLeft : base.panelSize[page][2] },
{ queue: false, duration: base.options.animationTime, easing: base.options.easing, complete: function(){ base.endAnimation(page, callback); } }
base.endAnimation = function(page, callback){
if (page === 0) {
base.$window.scrollLeft(base.panelSize[base.pages][2]);
page = base.pages;
} else if (page > base.pages) {
// reset back to start position
base.$window.scrollLeft(base.panelSize[1][2]);
page = 1;
base.setCurrentPage(page, false);
// Add active panel class
base.$items.removeClass('activePage').eq(page).addClass('activePage');
if (!base.hovered) { base.slideControls(false); }
// continue YouTube video if in current panel
if (base.hasEmb){
var emb = base.$currentPage.find('object[id*=ytvideo], embed[id*=ytvideo]');
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
if (emb.length && $.isFunction(emb[0].getPlayerState) && emb[0].getPlayerState() > 0 && emb[0].getPlayerState() !== 5) {
emb[0].playVideo();
base.$el.trigger('slide_complete', base);
// callback from external slide control: $('#slider').anythingSlider(4, function(slider){ })
if (typeof callback === 'function') { callback(base); }
// Continue slideshow after a delay
if (base.options.autoPlayLocked && !base.playing) {
setTimeout(function(){
base.startStop(true);
// subtract out slide delay as the slideshow waits that additional time.
}, base.options.resumeDelay - base.options.delay);
base.setCurrentPage = function(page, move) {
if (page > base.pages + 1 - base.adjustLimit) { page = base.pages - base.adjustLimit; }
if (page < base.adjustLimit ) { page = 1; }
// Set visual
if (base.options.buildNavigation){
base.$nav.find('.cur').removeClass('cur');
base.$nav.find('a').eq(page - 1).addClass('cur');
// hide/show arrows based on infinite scroll mode
if (!base.options.infiniteSlides && base.options.stopAtEnd){
base.$wrapper.find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled');
base.$wrapper.find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled');
if (page === base.pages && base.playing) { base.startStop(); }
// Only change left if move does not equal false
if (!move) {
base.$wrapper.css({
width: base.panelSize[page][0],
height: base.panelSize[page][1]
base.$wrapper.scrollLeft(0); // reset in case tabbing changed this scrollLeft
base.$window.scrollLeft( base.panelSize[page][2] );
// Update local variable
base.currentPage = page;
// Set current slider as active so keyboard navigation works properly
if (!base.$wrapper.is('.activeSlider')){
$('.activeSlider').removeClass('activeSlider');
base.$wrapper.addClass('activeSlider');
base.goForward = function(autoplay) {
if (autoplay !== true) { autoplay = false; base.startStop(false); }
base.gotoPage(base.currentPage + 1, autoplay);
base.goBack = function(autoplay) {
if (autoplay !== true) { autoplay = false; base.startStop(false); }
base.gotoPage(base.currentPage - 1, autoplay);
// This method tries to find a hash that matches panel-X
// If found, it tries to find a matching item
// If that is found as well, then that item starts visible
base.gotoHash = function(){
var n = base.win.location.hash.match(base.regex);
return (n===null) ? '' : parseInt(n[1],10);
base.setHash = function(n){
var s = 'panel' + base.runTimes + '-',
h = base.win.location.hash;
if ( typeof h !== 'undefined' ) {
base.win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n;
// Slide controls (nav and play/stop button up or down)
base.slideControls = function(toggle, playing){
var dir = (toggle) ? 'slideDown' : 'slideUp',
t1 = (toggle) ? 0 : base.options.animationTime,
t2 = (toggle) ? base.options.animationTime: 0,
sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden
if (base.options.toggleControls) {
base.$controls.stop(true,true).delay(t1)[dir](base.options.animationTime/2).delay(t2);
if (base.options.buildArrows && base.options.toggleArrows) {
if (!base.hovered && base.playing) { sign = 1; t2 = 0; } // don't animate arrows during slideshow
base.$forward.stop(true,true).delay(t1).animate({ right: sign * base.$arrowWidth, opacity: t2 }, base.options.animationTime/2);
base.$back.stop(true,true).delay(t1).animate({ left: sign * base.$arrowWidth, opacity: t2 }, base.options.animationTime/2);
base.clearTimer = function(paused){
// Clear the timer only if it is set
if (base.timer) {
base.win.clearInterval(base.timer);
if (!paused) {
base.$el.trigger('slideshow_stop', base);
// Handles stopping and playing the slideshow
// Pass startStop(false) to stop and startStop(true) to play
base.startStop = function(playing, paused) {
if (playing !== true) { playing = false; } // Default if not supplied is false
if (playing && !paused) {
base.$el.trigger('slideshow_start', base);
// Update variable
base.playing = playing;
// Toggle playing and text
if (base.options.autoPlay) {
base.$startStop.toggleClass('playing', playing).html( playing ? base.options.stopText : base.options.startText );
// add button text to title attribute if it is hidden by text-indent
if (parseInt(base.$startStop.css('text-indent'),10) < 0) {
base.$startStop.addClass(base.options.tooltipClass).attr('title', playing ? 'Stop' : 'Start');
if (playing){
base.clearTimer(true); // Just in case this was triggered twice in a row
base.timer = base.win.setInterval(function() {
// prevent autoplay if video is playing
if (!(base.hasEmb && base.checkVideo(playing))) {
if (base.options.playRtl) {
base.goBack(true);
} else {
base.goForward(true);
}, base.options.delay);
} else {
base.clearTimer();
base.checkVideo = function(playing){
// pause YouTube videos before scrolling?
var emb, ps, stopAdvance = false;
base.$items.find('object[id*=ytvideo], embed[id*=ytvideo]').each(function(){ // include embed for IE; if not using SWFObject, old detach/append code needs "object embed" here
emb = $(this);
if (emb.length && $.isFunction(emb[0].getPlayerState)) {
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
ps = emb[0].getPlayerState();
// if autoplay, video playing, video is in current panel and resume option are true, then don't advance
if (playing && (ps === 1 || ps > 2) && base.$items.index(emb.closest('li.panel')) === base.currentPage && base.options.resumeOnVideoEnd) {
stopAdvance = true;
} else {
// pause video if not autoplaying (if already initialized)
if (ps > 0) { emb[0].pauseVideo(); }
return stopAdvance;
// Trigger the initialization
base.init();
$.anythingSlider.defaults = {
// Appearance
width : null, // Override the default CSS width
height : null, // Override the default CSS height
resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport
tooltipClass : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
theme : 'default', // Theme name
themeDirectory : 'css/theme-{themeName}.css', // Theme directory & filename {themeName} is replaced by the theme value above
// Navigation
startPanel : 1, // This sets the initial panel
hashTags : true, // Should links change the hashtag in the URL?
infiniteSlides : true, // if false, the slider will not wrap
enableKeyboard : true, // if false, keyboard arrow keys will not work for the current panel.
buildArrows : true, // If true, builds the forwards and backwards buttons
toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times
buildNavigation : true, // If true, builds a list of anchor links to link to each panel
enableNavigation : true, // if false, navigation links will still be visible, but not clickable.
toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
appendControlsTo : null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
navigationFormatter : null, // Details at the top of the file on this use (advanced use)
forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
// Slideshow options
enablePlay : true, // if false, the play/stop button will still be visible, but not clickable.
autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
autoPlayLocked : false, // If true, user changing slides will not stop the slideshow
startStopped : false, // If autoPlay is on, this can force it to start stopped
pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video is complete
stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
playRtl : false, // If true, the slideshow will move right-to-left
startText : "Start", // Start button text
stopText : "Stop", // Stop button text
delay : 6000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
animationTime : 600, // How long the slideshow transition takes (in milliseconds)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
// Callbacks - removed from options to reduce size - they still work
// Interactivity
clickArrows : "click", // Event used to activate arrow functionality (e.g. "click" or "mouseenter")
clickControls : "click focusin", // Events used to activate navigation control functionality
clickSlideshow : "click", // Event used to activate slideshow play/stop button
// Misc options
addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
$.fn.anythingSlider = function(options, callback) {
return this.each(function(i){
var anySlide = $(this).data('AnythingSlider');
// initialize the slider but prevent multiple initializations
if ((typeof(options)).match('object|undefined')){
if (!anySlide) {
(new $.anythingSlider(this, options));
} else {
anySlide.updateSlider();
// If options is a number, process as an external link to page #: $(element).anythingSlider(#)
} else if (/\d/.test(options) && !isNaN(options) && anySlide) {
var page = (typeof(options) === "number") ? options : parseInt($.trim(options),10); // accepts " 2 "
// ignore out of bound pages
if ( page >= 1 && page <= anySlide.pages ) {
anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback
})(jQuery);
/* AnythingSlider works with works with jQuery 1.4+, but you can uncomment the code below to make it
work with jQuery 1.3.2. You'll have to manually add the code below to the minified copy if needed */
// Copied from jQuery 1.4.4 to make AnythingSlider backwards compatible to jQuery 1.3.2
if (typeof jQuery.fn.delay === 'undefined') {
jQuery.fn.extend({
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx";
return this.queue( type, function() { var elem = this; setTimeout(function() { jQuery.dequeue( elem, type ); }, time ); }); -
Displaying TOOL TIP message over an applet
Hi,
How to display a tooltip(hint) like message when the mouse moves over an applet. Here is the rough source code, Please do the needful.
import java.applet.*;
import java.awt.*;
public class Dis extends Applet implements MouseListner
public void init()
setLayout(null);
ButtonAb b = new ButtonAb("click me"); //this is another class that is being called here, this class extends Component, I have written all ActionListeners and MouseListeners in this class only
b.add();
//public void addMouseListener(MouseEvent me)
When the mouse moves over the Button("click me"), a hint box or tooltip like message should be displayed. It is easy doing with VB or Swing, but I wanted to it with AWT. Please give me some source code also.
Thanks in advance
UmaThere are several ways to implement tooltip in awt. I prefere a general ToolTip class that can be added to any Component, and that is easy to use:
something like this:Button but;
but = new Button("Push");
add(but);
new ToolTip(but, "Push this button if you want to push this button");The code above should add a ToolTip to the java.awt.Button, so that everytime the mouse hoovers over the button, the message gets displayed.
The idea is to make a ToolTip that can be added to any java.awt.Component using one line of code only. How do one achive that? Ok, here is a pseudo implementation of the ToolTip class:class ToolTip extends java.awt.Canvas implements Runnable, MouseListener, MouseMotionListener
private String m_strText;
private Component m_Component;
private Thread m_Thread;
private int m_iX;
private int m_iY;
public ToolTip(Component comp, String strText);
m_strText = strText;
m_Component = comp;
comp.addMouseMotionListener(this);
comp.addMouseListener(this);
public void run()
try{
Thread.sleep(500);
// Here its time to display the tooltip:
// We need to add it.
Component comp = this;
while((!comp instanceof Applet) &&
(!comp instanceof Frame))
comp = comp.getParent();
((Container)comp).add(this);
int x,y,w,h;
x = m_iX+m_Component.getLocationOnScreen().x-comp.getLocationOnScreen.x;
y = m_iY+m_Component.getLocationOnScreen().y - comp.getLocationOnScreen.y;
h=30;
w=getFontMetrics().stringWidth(m_strText);
setBounds(x,y,w,h);
cathc(InterruptedException e)
public void mouseEntered(MouseEvent e)
start(e.getX(), e.getY());
private void start(int iX, int iY);
m_iX = iX;
m_iY = iY;
m_Thread = new Thread(this);
m_Thread.start();
public void mouseExited(MouseEvent e)
stop();
public void mouseMoved(MouseEvent e)
stop();
start(e.getX(), e.getY());
private void stop()
if(m_Thread != null)
m_Thread.interrupt();
Container parent = getParent();
if(parent != null)
parent.remove(this);
public void paint(Graphics g)
g.drawString(m_strText, 0, 20);
g.drawRect(0,0,getSize().width, getSize().height);
}The baseclass could be changed to java.awt.Window.
using Window gives the ToolTip the posibillity to extend beyond the borders of the Applet (or the Frame), but in IE it gives you the "warning applet window" displayed on the botton of every ToolTip.
Ragnvald Barth
Software engineer -
J Tool Tips - Strange and Awkward Bug
Hello Everyone,
I am having a very strange J Tool Tip bug. Okay first of all, the tool tip that I have created works when it is inside of a single panel for a single label. Basically, what I have is a number of J Labels - each having a unique tool tip. Here is the most basic of my code (notice that I have customized my own Tool Tip to have a yellow background and black foreground):
currentLabel = new JLabel("LABEL TEST")
// Extends the JLabel and overrides createToolTip() to return a custom tool tip:
@Override
public JToolTip createToolTip()
JToolTip toolTip = super.createToolTip();
toolTip.setComponent(this);
toolTip.setBackground(Color.YELLOW);
toolTip.setForeground(Color.BLACK);
return toolTip;
currentLabel.setToolTipText("Testing Tool Tip Message");Okay, so here's the deal. Here's the tricky part. When I have this label nested inside of a Grid Bag Layout Panel, it works perfectly fine. It shows up when the user's mouse hovers over the label.
Here's my problem. The project that I am working on is actually nested in many complicated panels. This project has about 100 java files, so I am just going to cut it short and let you know which kind of panels it is nested in.
Starting from the lowest panel:
1. J Panel (Grid Bag Layout)
2. J Panel (Box Layout)
3. J Panel (Border Layout)
4. J Split Pane (Right Side)
5. J Panel (Border Layout) (Largest Panel)
One of the things I noticed is that now when I hover over the labels, a very small microscopic blue dot appears right to the left of the mouse cursor. I seriously think this is the Tool Tip, but for some reason it isn't showing any text. The strange thing is that the tool tip works when panels 2, 3, 4, and 5 are non-existent. If you guys have any ideas or suggestions, please let me know! I'd really appreciate it!
Thanks,
BrianWhat I might do is : see if listening for mouseEntered and mouseExited events work on the labels when in their complex arrangement. And make a little tooltip class based on JWindow (perhaps with a JLabel on its contentpane so you can display HTML). I found this approach more reliable. Though one would expect this is what is already implemented, the inbilt behaviour may overcomplicate things resulting in some no-shows. I seem to remember having this problem with tootips on table cell renderers.
Edited by: kina_tji on Jul 23, 2008 6:33 PM -
Kodo 3.1.12 and Eclipse
Hi,
I have added Kodo plugin to Eclipse (version 3) . I have added Kodo
enhancer to Build sequence for the project. However when I run build I get
an error and eclipse log file has following exception:
ava.lang.NoClassDefFoundError: org/apache/log4j/Category
at
com.solarmetric.log.Log4JLogFactory.newLogAdapter(Log4JLogFactory.java:19)
at com.solarmetric.log.LogFactoryAdapter.getLog(LogFactoryAdapter.java:25)
at
com.solarmetric.conf.ConfigurationImpl.getLog(ConfigurationImpl.java:115)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2168)
at
kodo.jdbc.integration.eclipse.EnhancerBuilder.build(EnhancerBuilder.java:40)
at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:564)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:157)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:249)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:202)
at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:229)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:232)
at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:268)
at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:297)
at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:198)
at
org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:182)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
I have copied the log4j jar to kodo plugin directory and added libarary
tag to plugin.xml as following:
<library name="log4j-1.2.8.jar"/>
What am I doing wrong?Mark,
Here is my plugin.xml. classes12.jar is in the same directory as the
plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="kodo"
name="%name"
version="1.0.1"
provider-name="%provider-name"
class="kodo.jdbc.integration.eclipse.KodoPlugin">
<runtime>
<!--
Put your jdbc driver in this directory and enter the filename
here (and configure in Preferences the changes you make) -->
<library name="classes12.jar"/>
<!-- ########### do not modify below ######### -->
<!-- ########### do not modify below ######### -->
<!-- ########### do not modify below ######### -->
<!-- ########### do not modify below ######### -->
<!-- ########### do not modify below ######### -->
<library name="kodo-jdo.jar"/>
<library name="jakarta-commons-collections-2.1.jar"/>
<library name="jakarta-commons-lang-1.0.1.jar"/>
<library name="jakarta-commons-pool-1.0.1.jar"/>
<library name="jakarta-regexp-1.1.jar"/>
<library name="jca1.0.jar"/>
<library name="jdbc2_0-stdext.jar"/>
<library name="jdo-1.0.1.jar"/>
<library name="jta-spec1_0_1.jar"/>
<library name="xalan.jar"/>
<library name="xercesImpl.jar"/>
<library name="xml-apis.jar"/>
<library name="jfreechart-0.9.16.jar"/>
<library name="jcommon-0.9.1.jar"/>
<library name="mx4j-admb.jar"/>
<library name="mx4j-jmx.jar"/>
<library name="mx4j-tools.jar"/>
<library name="jline.jar"/>
<library name="sqlline.jar"/>
</runtime>
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.jdt.core"/>
<import plugin="org.eclipse.jdt.launching"/>
</requires>
<extension point="org.eclipse.ui.actionSets">
<actionSet id="kodo.jdbc.integration.eclipse.actionSet"
label="%action-set-name"
visible="true">
<menu id="kodo.menu"
label="%group-label">
<separator name="baseGroup"/>
</menu>
<action id="kodo.removeBuilder"
label="%remove-builder-label"
class="kodo.jdbc.integration.eclipse.RemoveBuilderAction"
tooltip="%remove-builder-tooltip"
menubarPath="kodo.menu/baseGroup"
enablesFor="1">
</action>
<action id="kodo.addbuilder"
label="%add-builder-label"
class="kodo.jdbc.integration.eclipse.AddBuilderAction"
tooltip="%add-builder-tooltip"
menubarPath="kodo.menu/baseGroup"
enablesFor="1">
</action>
<action id="kodo.mapping.build"
label="%mapping-build-label"
tooltip="%mapping-build-tooltip"
class="kodo.jdbc.integration.eclipse.MappingToolAction$BuildSchema"
icon="icons/BuildSchemaMappingTool.gif"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="+">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
<action id="kodo.mapping.drop"
label="%mapping-drop-label"
tooltip="%mapping-drop-tooltip"
class="kodo.jdbc.integration.eclipse.MappingToolAction$Drop"
icon="icons/DropMappingTool.gif"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="+">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
<action id="kodo.mapping.refresh"
label="%mapping-refresh-label"
tooltip="%mapping-refresh-tooltip"
class="kodo.jdbc.integration.eclipse.MappingToolAction$Refresh"
icon="icons/RefreshMappingTool.gif"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="+">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
<action id="kodo.enhance"
label="%enhance-label"
icon="icons/EnhancerAction.gif"
class="kodo.jdbc.integration.eclipse.EnhancerAction"
tooltip="%enhance-tooltip"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="+">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
</actionSet>
</extension>
<!-- lock our actions into the base perspective -->
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
<actionSet
id="kodo.jdbc.integration.eclipse.actionSet">
</actionSet>
</perspectiveExtension>
</extension>
<!-- put our extensions in -->
<extension point="org.eclipse.ui.preferencePages">
<page name="%preference-name"
class="kodo.jdbc.integration.eclipse.KodoPreferencePage"
id="kodo.jdbc.integration.eclipse.preferences.KodoPreferencePage">
</page>
</extension>
<!-- lock in our eclipse-generated xml editor -->
<extension point="org.eclipse.ui.editors">
<editor name="%mappingeditor-name" extensions="mapping"
icon="icons/mapping.gif"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
id="kodo.jdbc.integration.eclipse.editor.XMLEditorMapping">
</editor>
<editor name="%editor-name" extensions="jdo,schema"
icon="icons/metadata.gif"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
id="kodo.jdbc.integration.eclipse.editor.XMLEditor">
</editor>
</extension>
<!-- lock in our "view" -->
<extension point="org.eclipse.ui.views">
<view id="kodo.jdbc.integration.eclipse.KodoView"
name="%view-name"
category="org.eclipse.jdt.ui.java"
icon="icons/kodosmall.gif"
class="kodo.jdbc.integration.eclipse.KodoView">
</view>
</extension>
<!-- lock in our builder -->
<extension point="org.eclipse.core.resources.builders"
id="kodo.jdbc.integration.eclipse.EnhancerBuilder"
name="%builder-name">
<builder>
<run
class="kodo.jdbc.integration.eclipse.EnhancerBuilder">
</run>
</builder>
</extension>
<!-- put our view onto the bottom bar -->
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.debug.ui.DebugPerspective">
<view id="kodo.jdbc.integration.eclipse.KodoView"
relative="org.eclipse.debug.ui.ExpressionView"
relationship="stack"/>
<viewShortcut id="org.eclipse.jdt.debug.ui.DisplayView"/>
</perspectiveExtension>
</extension>
</plugin>
Marc Prud'hommeaux wrote:
Genna-
Can you post your plugin.xml file? The majority of the time, this
problem is because of an error in the configuration file.
In article <[email protected]>, Genna Reingold wrote:
Ok,
I have found where log4j was coming from - I have selected my runtime
Kodo property file in Kodo preferences. Removing reference to property
file fixed the problem. However I have another issue now. When I run
refresh mapping I get following error:
<error>-An error occurred running MappingTool
kodo.util.FatalDataStoreException: oracle.jdbc.OracleDriver
NestedThrowables:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
I have upgraded to Kodo 3.1.15, I'm using latest Eclipse 3.0. I have
copied classes12.jar to plugin directory and modified plugin.xml as
prescribed in the manual.
Stephen Kim wrote:
Genna,
Also note that the Eclipse plugin uses its own logging mechanism.
Setting a kodo.Log property for the plugin's property file will not
change the way in which the plugin logs messages (you may want to have
an Eclipse specific property file with the Log property removed).
Marc Prud'hommeaux wrote:
Genna-
It sounds like Eclipse might have an older version of the log4j jar
file. Can you check to see if there are any other "log4j" jars in
Eclipse's environment?
Also, what version of Kodo are you using? Can you try with the latest
release (3.1.5)?
Finally, can you ensure that you are using the final 3.0 release of
Eclipse, and not one of the betas? There are some known problems with
some of the 3.0 betas.
In article <[email protected]>, Genna Reingold wrote:
Hi,
I have added Kodo plugin to Eclipse (version 3) . I have added Kodo
enhancer to Build sequence for the project. However when I run build I
get
an error and eclipse log file has following exception:
ava.lang.NoClassDefFoundError: org/apache/log4j/Category
atcom.solarmetric.log.Log4JLogFactory.newLogAdapter(Log4JLogFactory.java:19)
at
com.solarmetric.log.LogFactoryAdapter.getLog(LogFactoryAdapter.java:25)
atcom.solarmetric.conf.ConfigurationImpl.getLog(ConfigurationImpl.java:115)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2168)
at
kodo.jdbc.integration.eclipse.EnhancerBuilder.build(EnhancerBuilder.java:40)
at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:564)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:157)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:249)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:202)
at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:229)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:232)
at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:268)
at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:297)
at
org.eclipse.core.internal.resources.Workspace.build(Workspace.java:198)
atorg.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:182)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
I have copied the log4j jar to kodo plugin directory and added libarary
tag to plugin.xml as following:
<library name="log4j-1.2.8.jar"/>
What am I doing wrong?
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com
Marc Prud'hommeaux
SolarMetric Inc. -
Eclipse plug-in error - driver not found error with DB2
Hi,
i am using websphere studio developer and the kodo 3.0 implementation.
I have set up the kodo plug in and i get an error when i try to create the
database schema:
kodo.util.FatalDataStoreException: No suitable driver
It can't find the DB2 driver. This is the information I have in the kodo
properties:
javax.jdo.option.ConnectionDriverName: COM.ibm.db2.jdbc.app.DB2Driver
javax.jdo.option.ConnectionURL: jdbc:db2:baokodo
The DB2 driver jar is in the kodo eclipse plugin directory and I am
referencing this jar file in the plugin xml file.The plug in is finding the driver class but it does not like the driver
for some reason. It tells me no suitable driver found.
Here is my plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="kodo"
name="%name"
version="1.0.1"
provider-name="%provider-name"
class="kodo.jdbc.integration.eclipse.KodoPlugin">
<runtime>
<library name="db2java.jar"/>
<library name="kodo-jdo.jar"/>
<library name="jakarta-commons-collections-2.1.jar"/>
<library name="jakarta-commons-lang-1.0.1.jar"/>
<library name="jakarta-commons-logging-1.0.3.jar"/>
<library name="jakarta-commons-pool-1.0.1.jar"/>
<library name="jakarta-regexp-1.1.jar"/>
<library name="jca1.0.jar"/>
<library name="jdbc2_0-stdext.jar"/>
<library name="jdo-1.0.1.jar"/>
<library name="jta-spec1_0_1.jar"/>
<library name="xalan.jar"/>
<library name="xercesImpl.jar"/>
<library name="xml-apis.jar"/>
<library name="jfreechart-0.9.13.jar"/>
<library name="jcommon-0.8.8.jar"/>
</runtime>
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.jdt.core"/>
<import plugin="org.eclipse.jdt.launching"/>
</requires>
<extension point="org.eclipse.ui.actionSets">
<actionSet id="kodo.jdbc.integration.eclipse.actionSet"
label="%action-set-name"
visible="true">
<menu id="kodo.menu"
label="%group-label">
<separator name="baseGroup"/>
</menu>
<action id="kodo.removeBuilder"
label="%remove-builder-label"
class="kodo.jdbc.integration.eclipse.RemoveBuilderAction"
tooltip="%remove-builder-tooltip"
menubarPath="kodo.menu/baseGroup"
enablesFor="1">
</action>
<action id="kodo.addbuilder"
label="%add-builder-label"
class="kodo.jdbc.integration.eclipse.AddBuilderAction"
tooltip="%add-builder-tooltip"
menubarPath="kodo.menu/baseGroup"
enablesFor="1">
</action>
<action id="kodo.mapping.build"
label="%mapping-build-label"
tooltip="%mapping-build-tooltip"
class="kodo.jdbc.integration.eclipse.MappingToolAction$BuildSchema"
icon="icons/BuildSchemaMappingTool.gif"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="1">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
<action id="kodo.mapping.drop"
label="%mapping-drop-label"
tooltip="%mapping-drop-tooltip"
class="kodo.jdbc.integration.eclipse.MappingToolAction$Drop"
icon="icons/DropMappingTool.gif"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="1">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
<action id="kodo.mapping.refresh"
label="%mapping-refresh-label"
tooltip="%mapping-refresh-tooltip"
class="kodo.jdbc.integration.eclipse.MappingToolAction$Refresh"
icon="icons/RefreshMappingTool.gif"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="1">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
<action id="kodo.enhance"
label="%enhance-label"
icon="icons/EnhancerAction.gif"
class="kodo.jdbc.integration.eclipse.EnhancerAction"
tooltip="%enhance-tooltip"
menubarPath="kodo.menu/baseGroup"
toolbarPath="Normal/Kodo"
enablesFor="1">
<selection class="org.eclipse.core.resources.IFile"
name="*.jdo">
</selection>
</action>
</actionSet>
</extension>
<!-- lock our actions into the base perspective -->
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
<actionSet
id="kodo.jdbc.integration.eclipse.actionSet">
</actionSet>
</perspectiveExtension>
</extension>
<!-- put our extensions in -->
<extension point="org.eclipse.ui.preferencePages">
<page name="%preference-name"
class="kodo.jdbc.integration.eclipse.KodoPreferencePage"
id="kodo.jdbc.integration.eclipse.preferences.KodoPreferencePage">
</page>
</extension>
<!-- lock in our eclipse-generated xml editor -->
<extension point="org.eclipse.ui.editors">
<editor name="%mappingeditor-name" extensions="mapping"
icon="icons/mapping.gif"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
id="kodo.jdbc.integration.eclipse.editor.XMLEditorMapping">
</editor>
<editor name="%editor-name" extensions="jdo,schema"
icon="icons/metadata.gif"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
id="kodo.jdbc.integration.eclipse.editor.XMLEditor">
</editor>
</extension>
<!-- lock in our "view" -->
<extension point="org.eclipse.ui.views">
<view id="kodo.jdbc.integration.eclipse.KodoView"
name="%view-name"
category="org.eclipse.jdt.ui.java"
icon="icons/kodosmall.gif"
class="kodo.jdbc.integration.eclipse.KodoView">
</view>
</extension>
<!-- lock in our builder -->
<extension point="org.eclipse.core.resources.builders"
id="kodo.jdbc.integration.eclipse.EnhancerBuilder"
name="%builder-name">
<builder>
<run
class="kodo.jdbc.integration.eclipse.EnhancerBuilder">
</run>
</builder>
</extension>
<!-- put our view onto the bottom bar -->
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.debug.ui.DebugPerspective">
<view id="kodo.jdbc.integration.eclipse.KodoView"
relative="org.eclipse.debug.ui.ExpressionView"
relationship="stack"/>
<viewShortcut id="org.eclipse.jdt.debug.ui.DisplayView"/>
</perspectiveExtension>
</extension>
</plugin>
Here is the kodo.properties file:
# Kodo JDO Properties configuration
# To evaluate or purchase a license key, visit http://www.solarmetric.com
kodo.LicenseKey: xxxxxxx
javax.jdo.PersistenceManagerFactoryClass:
kodo.jdbc.runtime.JDBCPersistenceManagerFactory
javax.jdo.option.ConnectionDriverName: COM.ibm.db2.jdbc.app.DB2Driver
javax.jdo.option.ConnectionUserName: db2admin
javax.jdo.option.ConnectionPassword: db2admin
javax.jdo.option.ConnectionURL: jdbc:db2:baokodo
javax.jdo.option.Optimistic: true
javax.jdo.option.RetainValues: true
javax.jdo.option.NontransactionalRead: true
# By default, Kodo stores object-relational mapping information in .mapping
# files. Other common options are storing the information in a special
# database table Kodo creates or as extensions in JDO metadata. Uncomment
# one of the properties below to use one of these options. See the
reference
# guide for a full list of mapping factories to choose from.
#kodo.jdbc.MappingFactory: db
#kodo.jdbc.MappingFactory: metadata
# Kodo provides a management / monitoring capability. It can be enabled
# locally (in the same JVM) by setting the kodo.ManagementUI property to
# "gui". Remote management / monitoring can be enabled by setting the
# kodo.ManagementServer property, and by running the remotemanagementtool
# in another process.
# kodo.ManagementUI: gui
# kodo.ManagementServer: true(host="localhost",port=1234)
Stephen Kim wrote:
Can you post your plugin.xml? We have tested against WebSphere Studio 4
and 5.
TD wrote:
I am specifying a properties file in the preferences pane.
Still not sure why this doesn't work...
Have you been able to get it to work in websphere studio.
Stephen Kim wrote:
The plugin does not use any kodo.properties by default. You have to
configure it through the Preferences pane (which you can point to your
kodo.properties file)
TD wrote:
Hi,
i am using websphere studio developer and the kodo 3.0 implementation.
I have set up the kodo plug in and i get an error when i try to create the
database schema:
kodo.util.FatalDataStoreException: No suitable driver
It can't find the DB2 driver. This is the information I have in the kodo
properties:
javax.jdo.option.ConnectionDriverName: COM.ibm.db2.jdbc.app.DB2Driver
javax.jdo.option.ConnectionURL: jdbc:db2:baokodo
The DB2 driver jar is in the kodo eclipse plugin directory and I am
referencing this jar file in the plugin xml file.
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com
Maybe you are looking for
-
Help need in creation of auth object
Hi all, can anyone assist me in creating an auth object to restrict users based on plant. I would appreciate i anyone of you could send me screen shots of the procedure. My email id is <b><removed by moderator></b> Thanks Venki
-
It says in the specification that it charges via usb but it is not. Is any other user facing this type of problem or not ?
-
Does apple replace ipod touch screens? A white hue around the black screen
Ok, so i noticed that on my ipod touch that there's some kind of whitish hue around the screen.I just got this replaced by a furbished but i set up an appointment for tomorrow.I have not dropped it, there's no cracks, there's no water damage nothing.
-
Red boxes appeared everywhere in my document
Downloaded acrbat seeking a name from the 60 page form. Thought I would seek all in one step. DISASSTER Red boxes appeared all over the document ! None dealing with the name I am searching.
-
Problem importing VHS on intel iMac
I import VHS into iMovie using a Canopus ADV C100 converter via Firewire. I used to import onto an iMac G5 no problem. Now I switched to a new iMac Intel. When I now preview the VHS tape there is no audio, although the audio is captured when I import